Changeset 2385 for trunk/Clp/src/ClpDummyMatrix.hpp
 Timestamp:
 Jan 6, 2019 2:43:06 PM (3 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpDummyMatrix.hpp
r2271 r2385 6 6 #ifndef ClpDummyMatrix_H 7 7 #define ClpDummyMatrix_H 8 9 8 10 9 #include "CoinPragma.hpp" … … 17 16 */ 18 17 19 20 18 class ClpDummyMatrix : public ClpMatrixBase { 21 19 22 20 public: 23 /**@name Useful methods */ 24 //@{ 25 /// Return a complete CoinPackedMatrix 26 virtual CoinPackedMatrix * getPackedMatrix() const; 27 /** Whether the packed matrix is column major ordered or not. */ 28 virtual bool isColOrdered() const { 29 return true; 30 } 31 /** Number of entries in the packed matrix. */ 32 virtual CoinBigIndex getNumElements() const { 33 return numberElements_; 34 } 35 /** Number of columns. */ 36 virtual int getNumCols() const { 37 return numberColumns_; 38 } 39 /** Number of rows. */ 40 virtual int getNumRows() const { 41 return numberRows_; 42 } 21 /**@name Useful methods */ 22 //@{ 23 /// Return a complete CoinPackedMatrix 24 virtual CoinPackedMatrix *getPackedMatrix() const; 25 /** Whether the packed matrix is column major ordered or not. */ 26 virtual bool isColOrdered() const 27 { 28 return true; 29 } 30 /** Number of entries in the packed matrix. */ 31 virtual CoinBigIndex getNumElements() const 32 { 33 return numberElements_; 34 } 35 /** Number of columns. */ 36 virtual int getNumCols() const 37 { 38 return numberColumns_; 39 } 40 /** Number of rows. */ 41 virtual int getNumRows() const 42 { 43 return numberRows_; 44 } 43 45 44 46 /** A vector containing the elements in the packed matrix. Note that there 45 47 might be gaps in this list, entries that do not belong to any 46 48 majordimension vector. To get the actual elements one should look at 47 49 this vector together with vectorStarts and vectorLengths. */ 48 virtual const double *getElements() const;49 50 virtual const double *getElements() const; 51 /** A vector containing the minor indices of the elements in the packed 50 52 matrix. Note that there might be gaps in this list, entries that do not 51 53 belong to any majordimension vector. To get the actual elements one 52 54 should look at this vector together with vectorStarts and 53 55 vectorLengths. */ 54 virtual const int *getIndices() const;56 virtual const int *getIndices() const; 55 57 56 virtual const CoinBigIndex *getVectorStarts() const;57 58 virtual const int *getVectorLengths() const;58 virtual const CoinBigIndex *getVectorStarts() const; 59 /** The lengths of the majordimension vectors. */ 60 virtual const int *getVectorLengths() const; 59 61 60 61 virtual void deleteCols(const int numDel, const int *indDel);62 63 virtual void deleteRows(const int numDel, const int *indDel);64 65 virtual ClpMatrixBase *reverseOrderedCopy() const;66 67 virtual int countBasis(const int *whichColumn,68 int &numberColumnBasic);69 70 virtual void fillBasis(ClpSimplex *model,71 const int *whichColumn,72 int &numberColumnBasic,73 int * row, int *start,74 int * rowCount, int *columnCount,75 CoinFactorizationDouble *element);76 62 /** Delete the columns whose indices are listed in <code>indDel</code>. */ 63 virtual void deleteCols(const int numDel, const int *indDel); 64 /** Delete the rows whose indices are listed in <code>indDel</code>. */ 65 virtual void deleteRows(const int numDel, const int *indDel); 66 /** Returns a new matrix in reverse order without gaps */ 67 virtual ClpMatrixBase *reverseOrderedCopy() const; 68 /// Returns number of elements in column part of basis 69 virtual int countBasis(const int *whichColumn, 70 int &numberColumnBasic); 71 /// Fills in column part of basis 72 virtual void fillBasis(ClpSimplex *model, 73 const int *whichColumn, 74 int &numberColumnBasic, 75 int *row, int *start, 76 int *rowCount, int *columnCount, 77 CoinFactorizationDouble *element); 78 /** Unpacks a column into an CoinIndexedvector 77 79 */ 78 virtual void unpack(const ClpSimplex * model, CoinIndexedVector *rowArray,79 int column) const;80 80 virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, 81 int column) const; 82 /** Unpacks a column into an CoinIndexedvector 81 83 ** in packed foramt 82 84 Note that model is NOT const. Bounds and objective could 83 85 be modified if doing column generation (just for this variable) */ 84 virtual void unpackPacked(ClpSimplex *model,85 CoinIndexedVector *rowArray,86 87 86 virtual void unpackPacked(ClpSimplex *model, 87 CoinIndexedVector *rowArray, 88 int column) const; 89 /** Adds multiple of a column into an CoinIndexedvector 88 90 You can use quickAdd to add to vector */ 89 virtual void add(const ClpSimplex * model, CoinIndexedVector *rowArray,90 int column, double multiplier) const;91 92 virtual void add(const ClpSimplex * model, double *array,93 94 95 96 97 91 virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray, 92 int column, double multiplier) const; 93 /** Adds multiple of a column into an array */ 94 virtual void add(const ClpSimplex *model, double *array, 95 int column, double multiplier) const; 96 /// Allow any parts of a created CoinMatrix to be deleted 97 /// Allow any parts of a created CoinPackedMatrix to be deleted 98 virtual void releasePackedMatrix() const {} 99 //@} 98 100 99 100 101 101 /**@name Matrix times vector methods */ 102 //@{ 103 /** Return <code>y + A * scalar *x</code> in <code>y</code>. 102 104 @pre <code>x</code> must be of size <code>numColumns()</code> 103 105 @pre <code>y</code> must be of size <code>numRows()</code> */ 104 105 const double * x, double *y) const;106 107 108 const double * x, double *y,109 const double *rowScale,110 const double *columnScale) const;111 106 virtual void times(double scalar, 107 const double *x, double *y) const; 108 /// And for scaling 109 virtual void times(double scalar, 110 const double *x, double *y, 111 const double *rowScale, 112 const double *columnScale) const; 113 /** Return <code>y + x * scalar * A</code> in <code>y</code>. 112 114 @pre <code>x</code> must be of size <code>numRows()</code> 113 115 @pre <code>y</code> must be of size <code>numColumns()</code> */ 114 115 const double * x, double *y) const;116 117 118 const double * x, double *y,119 const double *rowScale,120 const double *columnScale) const;116 virtual void transposeTimes(double scalar, 117 const double *x, double *y) const; 118 /// And for scaling 119 virtual void transposeTimes(double scalar, 120 const double *x, double *y, 121 const double *rowScale, 122 const double *columnScale) const; 121 123 122 using ClpMatrixBase::transposeTimes;123 124 using ClpMatrixBase::transposeTimes; 125 /** Return <code>x * scalar * A + y</code> in <code>z</code>. 124 126 Can use y as temporary array (will be empty at end) 125 127 Note  If x packed mode  then z packed mode */ 126 virtual void transposeTimes(const ClpSimplex *model, double scalar,127 const CoinIndexedVector *x,128 CoinIndexedVector *y,129 CoinIndexedVector *z) const;130 128 virtual void transposeTimes(const ClpSimplex *model, double scalar, 129 const CoinIndexedVector *x, 130 CoinIndexedVector *y, 131 CoinIndexedVector *z) const; 132 /** Return <code>x *A</code> in <code>z</code> but 131 133 just for indices in y. 132 134 Note  If x packed mode  then z packed mode 133 135 Squashes small elements and knows about ClpSimplex */ 134 virtual void subsetTransposeTimes(const ClpSimplex *model,135 const CoinIndexedVector *x,136 const CoinIndexedVector *y,137 CoinIndexedVector *z) const;138 136 virtual void subsetTransposeTimes(const ClpSimplex *model, 137 const CoinIndexedVector *x, 138 const CoinIndexedVector *y, 139 CoinIndexedVector *z) const; 140 //@} 139 141 140 141 142 142 /**@name Other */ 143 //@{ 144 //@} 143 145 146 /**@name Constructors, destructor */ 147 //@{ 148 /** Default constructor. */ 149 ClpDummyMatrix(); 150 /// Constructor with data 151 ClpDummyMatrix(int numberColumns, int numberRows, 152 int numberElements); 153 /** Destructor */ 154 virtual ~ClpDummyMatrix(); 155 //@} 144 156 145 /**@name Constructors, destructor */ 146 //@{ 147 /** Default constructor. */ 148 ClpDummyMatrix(); 149 /// Constructor with data 150 ClpDummyMatrix(int numberColumns, int numberRows, 151 int numberElements); 152 /** Destructor */ 153 virtual ~ClpDummyMatrix(); 154 //@} 157 /**@name Copy method */ 158 //@{ 159 /** The copy constructor. */ 160 ClpDummyMatrix(const ClpDummyMatrix &); 161 /** The copy constructor from an CoinDummyMatrix. */ 162 ClpDummyMatrix(const CoinPackedMatrix &); 155 163 156 /**@name Copy method */ 157 //@{ 158 /** The copy constructor. */ 159 ClpDummyMatrix(const ClpDummyMatrix&); 160 /** The copy constructor from an CoinDummyMatrix. */ 161 ClpDummyMatrix(const CoinPackedMatrix&); 162 163 ClpDummyMatrix& operator=(const ClpDummyMatrix&); 164 /// Clone 165 virtual ClpMatrixBase * clone() const ; 166 //@} 167 164 ClpDummyMatrix &operator=(const ClpDummyMatrix &); 165 /// Clone 166 virtual ClpMatrixBase *clone() const; 167 //@} 168 168 169 169 protected: 170 170 /**@name Data members 171 171 The data members are protected to allow access for derived classes. */ 172 173 174 175 176 177 178 172 //@{ 173 /// Number of rows 174 int numberRows_; 175 /// Number of columns 176 int numberColumns_; 177 /// Number of elements 178 int numberElements_; 179 179 180 180 //@} 181 181 }; 182 182 183 183 #endif 184 185 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 186 */
Note: See TracChangeset
for help on using the changeset viewer.