6 #ifndef ClpPackedMatrix_H
7 #define ClpPackedMatrix_H
80 virtual void deleteCols(
const int numDel,
const int * indDel);
82 virtual void deleteRows(
const int numDel,
const int * indDel);
95 const double * element,
int numberOther = -1);
101 const int numReplace,
const double * newElements) {
108 bool keepZero =
false) {
115 int & numberColumnBasic);
118 const int * whichColumn,
119 int & numberColumnBasic,
120 int * row,
int * start,
121 int * rowCount,
int * columnCount,
146 double smallest,
double largest,
151 virtual void rangeOfElements(
double & smallestNegative,
double & largestNegative,
152 double & smallestPositive,
double & largestPositive);
168 int column,
double multiplier)
const ;
171 int column,
double multiplier)
const;
183 int & bestSequence,
int & numberWanted);
187 virtual void reallyScale(
const double * rowScale,
const double * columnScale);
201 virtual void times(
double scalar,
202 const double * x,
double * y)
const;
204 virtual void times(
double scalar,
205 const double * x,
double * y,
206 const double * rowScale,
207 const double * columnScale)
const;
212 const double * x,
double * y)
const;
215 const double * x,
double * y,
216 const double * rowScale,
217 const double * columnScale,
218 double * spare = NULL)
const;
225 const double * pi,
double * y,
226 const double * rowScale,
227 const double * columnScale,
228 double * spare = NULL)
const;
270 double referenceIn,
double devex,
272 unsigned int * reference,
273 double * weights,
double scaleFactor);
278 double referenceIn,
double devex,
280 unsigned int * reference,
281 double * weights,
double scaleFactor);
313 return ((
flags_ & 1) != 0);
317 return ((
flags_ & 16) != 0);
353 int numberRows,
const int * whichRows,
354 int numberColumns,
const int * whichColumns);
356 int numberRows,
const int * whichRows,
357 int numberColumns,
const int * whichColumns);
370 int numberRows,
const int * whichRows,
371 int numberColumns,
const int * whichColumns)
const ;
384 const double tolerance)
const;
390 const double tolerance)
const;
395 const unsigned char * status,
396 const double tolerance)
const;
402 const unsigned char * status,
407 double & bestPossible,
408 double acceptablePivot,
409 double dualTolerance,
410 int & numberRemaining,
411 const double zeroTolerance)
const;
417 const unsigned char * status,
418 const double tolerance)
const;
424 const double tolerance,
425 const double scalar)
const;
431 const double tolerance,
432 const double scalar)
const;
439 const double tolerance,
440 const double scalar)
const;
443 CoinIndexedVector * spareVector,
const double tolerance,
const double scalar)
const;
446 const double tolerance,
const double scalar)
const;
478 double acceptablePivot;
485 double * bestPossiblePtr;
486 double * upperThetaPtr;
488 double * freePivotPtr;
490 const unsigned short * count;
493 const double * element;
494 const unsigned short * column;
496 int numberInRowArray;
557 pthread_t * threadId_;
558 dualColumn0Struct * info_;
583 const double * piWeight,
584 double referenceIn,
double devex,
586 unsigned int * reference,
587 double * weights,
double scaleFactor);
bool usefulInfo() const
Returns true if copy has useful information.
int getVectorSize(const int i) const
The length of i'th vector.
int gutsOfTransposeTimesByRowGE3(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, double *COIN_RESTRICT array2, const double tolerance, const double scalar) const
Meat of transposeTimes by row n > 2 if packed - returns number nonzero.
ClpPackedMatrix3 * columnCopy_
Special column copy.
CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
virtual void replaceVector(const int index, const int numReplace, const double *newElements)
Replace the elements of a vector.
int type() const
Returns type.
virtual void subsetTransposeTimes(const ClpSimplex *model, const CoinIndexedVector *x, const CoinIndexedVector *y, CoinIndexedVector *z) const
Return <code>x *A</code> in <code>z</code> but just for indices in y.
ClpPackedMatrix2 & operator=(const ClpPackedMatrix2 &)
virtual void add(const ClpSimplex *model, CoinIndexedVector *rowArray, int column, double multiplier) const
Adds multiple of a column into an CoinIndexedvector You can use quickAdd to add to vector...
Abstract base class for Clp Matrices.
int flags_
Flags - 1 - has zero elements 2 - has gaps 4 - has special row copy 8 - has special column copy 16 - ...
virtual void scaleRowCopy(ClpModel *model) const
Scales rowCopy if column copy scaled Only called if scales already exist.
void specialRowCopy(ClpSimplex *model, const ClpMatrixBase *rowCopy)
make special row copy
virtual int appendMatrix(int number, int type, const CoinBigIndex *starts, const int *index, const double *element, int numberOther=-1)
Append a set of rows/columns to the end of the matrix.
void transposeTimes(const ClpSimplex *model, const CoinPackedMatrix *rowCopy, const CoinIndexedVector *x, CoinIndexedVector *spareArray, CoinIndexedVector *z) const
Return x * -1 * A in z.
void transposeTimesSubset(int number, const int *which, const double *pi, double *y, const double *rowScale, const double *columnScale, double *spare=NULL) const
Return y - pi * A in y.
void swapOne(const ClpSimplex *model, const ClpPackedMatrix *matrix, int iColumn)
Swap one variable.
int * offset_
Column offset for each block (plus one at end)
virtual void deleteCols(const int numDel, const int *indDel)
Delete the columns whose indices are listed in indDel.
virtual bool allElementsInRange(ClpModel *model, double smallest, double largest, int check=15)
Checks if all elements are in valid range.
virtual int getNumRows() const
Number of rows.
void modifyCoefficient(int row, int column, double newElement, bool keepZero=false)
Modify one element of packed matrix.
void setMatrixNull()
Just sets matrix_ to NULL so it can be used elsewhere.
void gutsOfTransposeTimesByRowEQ2(const CoinIndexedVector *piVector, CoinIndexedVector *output, CoinIndexedVector *spareVector, const double tolerance, const double scalar) const
Meat of transposeTimes by row n == 2 if packed.
double reducedCost(ClpSimplex *model, int sequence) const
Returns reduced cost of a variable.
virtual void deleteRows(const int numDel, const int *indDel)
Delete the rows whose indices are listed in indDel.
void checkFlags(int type) const
Check validity.
void clearCopies()
Gets rid of special copies.
virtual ClpMatrixBase * clone() const
Clone.
void createScaledMatrix(ClpSimplex *model) const
Creates scaled column copy if scales exist.
bool hasGaps() const
Whether the packed matrix has gaps or not.
void setNumberActiveColumns(int value)
Set number of active columns (normally same as number of columns)
int * column_
Column indices and reverse lookup (within block)
int numberActiveColumns() const
number of active columns (normally same as number of columns)
double * element_
Elements.
virtual void times(double scalar, const double *x, double *y) const
Return y + A * scalar *x in y.
virtual CoinBigIndex getNumElements() const
Number of entries in the packed matrix.
bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
virtual const CoinBigIndex * getVectorStarts() const
Abstract base class for various sparse vectors.
virtual void correctSequence(const ClpSimplex *model, int &sequenceIn, int &sequenceOut)
Correct sequence in and out to give true value.
CoinPackedMatrix * matrix_
Data.
virtual CoinPackedMatrix * getPackedMatrix() const
Return a complete CoinPackedMatrix.
int getNumCols() const
Number of columns.
double CoinFactorizationDouble
unsigned short * column_
columns within block
virtual void copy(const ClpPackedMatrix *from)
Copy contents - resizing if necessary - otherwise re-use memory.
void specialColumnCopy(ClpSimplex *model)
make special column copy
virtual void fillBasis(ClpSimplex *model, const int *whichColumn, int &numberColumnBasic, int *row, int *start, int *rowCount, int *columnCount, CoinFactorizationDouble *element)
Fills in column part of basis.
This solves LPs using the simplex method.
CoinBigIndex * start_
Starts for odd/long vectors.
virtual ~ClpPackedMatrix3()
Destructor.
ClpPackedMatrix()
Default constructor.
virtual void appendRows(int number, const CoinPackedVectorBase *const *rows)
Append Rows.
const CoinBigIndex * getVectorStarts() const
The positions where the major-dimension vectors start in elements and indices.
virtual ClpMatrixBase * scaledColumnCopy(ClpModel *model) const
Realy really scales column copy Only called if scales already exist.
void transposeTimesByColumn(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
virtual void releasePackedMatrix() const
Allow any parts of a created CoinPackedMatrix to be deleted.
virtual ClpMatrixBase * reverseOrderedCopy() const
Returns a new matrix in reverse order without gaps.
virtual ~ClpPackedMatrix2()
Destructor.
double * getMutableElements() const
A vector containing the elements in the packed matrix.
virtual bool canDoPartialPricing() const
Says whether it can do partial pricing.
const double * getElements() const
A vector containing the elements in the packed matrix.
virtual void rangeOfElements(double &smallestNegative, double &largestNegative, double &smallestPositive, double &largestPositive)
Returns largest and smallest elements of both signs.
virtual bool canCombine(const ClpSimplex *model, const CoinIndexedVector *pi) const
Returns true if can combine transposeTimes and subsetTransposeTimes and if it would be faster...
virtual CoinBigIndex countBasis(const int *whichColumn, int &numberColumnBasic)
Returns number of elements in column part of basis.
bool zeros() const
Are there zeros?
int getNumRows() const
Number of rows.
void checkGaps()
Sets flags_ correctly.
virtual int getVectorLength(int index) const
The length of a single major-dimension vector.
virtual void unpack(const ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector.
virtual void transposeTimesByRow(const ClpSimplex *model, double scalar, const CoinIndexedVector *x, CoinIndexedVector *y, CoinIndexedVector *z) const
Return x * scalar * A + y in z.
int numberActiveColumns_
number of active columns (normally same as number of columns)
virtual CoinBigIndex * dubiousWeights(const ClpSimplex *model, int *inputWeights) const
Given positive integer weights for each row fills in sum of weights for each column (and slack)...
int gutsOfTransposeTimesScaled(const double *COIN_RESTRICT pi, const double *COIN_RESTRICT columnScale, int *COIN_RESTRICT index, double *COIN_RESTRICT array, const double tolerance) const
Meat of transposeTimes by column when scaled.
Sparse Matrix Base Class.
virtual void reallyScale(const double *rowScale, const double *columnScale)
virtual void appendCols(int number, const CoinPackedVectorBase *const *columns)
Append Columns.
void replaceVector(const int index, const int numReplace, const double *newElements)
Replace the elements of a vector.
ClpPackedMatrix & operator=(const ClpPackedMatrix &)
virtual const double * getElements() const
A vector containing the elements in the packed matrix.
virtual bool isColOrdered() const
Whether the packed matrix is column major ordered or not.
int numberColumns_
Number of columns.
virtual void transposeTimes(double scalar, const double *x, double *y) const
Return y + x * scalar * A in y.
bool wantsSpecialColumnCopy() const
Do we want special column copy.
const int * getVectorLengths() const
The lengths of the major-dimension vectors.
virtual void partialPricing(ClpSimplex *model, double start, double end, int &bestSequence, int &numberWanted)
Partial pricing.
virtual const int * getVectorLengths() const
The lengths of the major-dimension vectors.
unsigned short * count_
Counts of elements in each part of row.
CoinBigIndex startElements_
CoinPackedMatrix * matrix() const
Returns CoinPackedMatrix (non const)
virtual void setDimensions(int numrows, int numcols)
Set the dimensions of the matrix.
int gutsOfTransposeTimesByRowGEK(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, int numberColumns, const double tolerance, const double scalar) const
Meat of transposeTimes by row n > K if packed - returns number nonzero.
const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
int gutsOfTransposeTimesUnscaled(const double *COIN_RESTRICT pi, int *COIN_RESTRICT index, double *COIN_RESTRICT array, const double tolerance) const
Meat of transposeTimes by column when not scaled.
int numberBlocks_
Number of blocks.
void transposeTimes2(const ClpSimplex *model, const double *pi, CoinIndexedVector *dj1, const double *piWeight, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates two arrays for steepest.
void releaseSpecialColumnCopy()
Say we don't want special column copy.
void useEffectiveRhs(ClpSimplex *model)
Sets up an effective RHS.
void transposeTimes(const ClpSimplex *model, const double *pi, CoinIndexedVector *output) const
Return x * -1 * A in z.
virtual ~ClpPackedMatrix()
Destructor.
void gutsOfTransposeTimesByRowEQ1(const CoinIndexedVector *piVector, CoinIndexedVector *output, const double tolerance, const double scalar) const
Meat of transposeTimes by row n == 1 if packed.
int numberRows_
Number of rows.
virtual void subsetTimes2(const ClpSimplex *model, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *dj2, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates second array for steepest and does devex weights.
virtual void modifyCoefficient(int row, int column, double newElement, bool keepZero=false)
Modify one element of packed matrix.
virtual ClpMatrixBase * subsetClone(int numberRows, const int *whichRows, int numberColumns, const int *whichColumns) const
Subset clone (without gaps).
void sortBlocks(const ClpSimplex *model)
Sort blocks.
virtual int refresh(ClpSimplex *model)
makes sure active columns correct
ClpPackedMatrix2 * rowCopy_
Special row copy.
int gutsOfTransposeTimesByRowGE3a(const CoinIndexedVector *COIN_RESTRICT piVector, int *COIN_RESTRICT index, double *COIN_RESTRICT output, int *COIN_RESTRICT lookup, char *COIN_RESTRICT marked, const double tolerance, const double scalar) const
Meat of transposeTimes by row n > 2 if packed - returns number nonzero.
double * work_
work arrays
CoinBigIndex * rowStart_
Row starts.
virtual void unpackPacked(ClpSimplex *model, CoinIndexedVector *rowArray, int column) const
Unpacks a column into an CoinIndexedvector in packed foramt Note that model is NOT const...
virtual const int * getIndices() const
A vector containing the minor indices of the elements in the packed matrix.
blockStruct * block_
Blocks (ordinary start at 0 and go to first block)
ClpPackedMatrix3 & operator=(const ClpPackedMatrix3 &)
ClpPackedMatrix2()
Default constructor.
virtual int getNumCols() const
Number of columns.
double * getMutableElements() const
Mutable elements.
virtual void transposeTimes2(const ClpSimplex *model, const CoinIndexedVector *pi1, CoinIndexedVector *dj1, const CoinIndexedVector *pi2, CoinIndexedVector *spare, double referenceIn, double devex, unsigned int *reference, double *weights, double scaleFactor)
Updates two arrays for steepest.
int numberBlocks_
Number of blocks.
virtual int scale(ClpModel *model, const ClpSimplex *baseModel=NULL) const
Creates scales for column copy (rowCopy in model may be modified) returns non-zero if no scaling done...
ClpPackedMatrix3()
Default constructor.
void makeSpecialColumnCopy()
Say we want special column copy.