PIPS-NLP
Public Member Functions | Protected Attributes | List of all members
SparseGenMatrix Class Reference

#include <SparseGenMatrix.h>

Inheritance diagram for SparseGenMatrix:
GenMatrix DoubleMatrix IotrRefCount SeqSparseGenMatrix

Public Member Functions

 SparseGenMatrix ()
 
 SparseGenMatrix (int rows, int cols, int nnz)
 
 SparseGenMatrix (int rows, int cols, int nnz, int krowM[], int jcolM[], double M[], int deleteElts=0)
 
virtual void getSize (long long &m, long long &n)
 
virtual void getSize (int &m, int &n)
 
virtual int numberOfNonZeros ()
 
virtual int isKindOf (int matType)
 
virtual void atPutDense (int row, int col, double *A, int lda, int rowExtent, int colExtent)
 
virtual void fromGetDense (int row, int col, double *A, int lda, int rowExtent, int colExtent)
 
virtual void fromAddDense (int row, int col, double *A, int lda, int rowExtent, int colExtent)
 
virtual void ColumnScale (OoqpVector &vec)
 
virtual void RowScale (OoqpVector &vec)
 
virtual void SymmetricScale (OoqpVector &vec)
 
virtual void scalarMult (double num)
 
virtual void fromGetSpRow (int row, int col, double A[], int lenA, int jcolA[], int &nnz, int colExtent, int &info)
 
virtual void atPutSubmatrix (int destRow, int destCol, DoubleMatrix &M, int srcRow, int srcCol, int rowExtent, int colExtent)
 
virtual void atPutSpRow (int col, double A[], int lenA, int jcolA[], int &info)
 
virtual void putSparseTriple (int irow[], int len, int jcol[], double A[], int &info)
 
virtual void getDiagonal (OoqpVector &vec)
 
virtual void setToDiagonal (OoqpVector &vec)
 
virtual void mult (double beta, OoqpVector &y, double alpha, OoqpVector &x)
 
virtual void mult (double beta, double y[], int incy, double alpha, double x[], int incx)
 
virtual void transMult (double beta, OoqpVector &y, double alpha, OoqpVector &x)
 
virtual void transMult (double beta, OoqpVector &y_in, int incy, double alpha, OoqpVector &x_in, int incx)
 
virtual void transMult (double beta, double y_in[], int incy, double alpha, double x_in[], int incx)
 
virtual void matTransDMultMat (OoqpVector &d, SymMatrix **res)
 
virtual void matTransDinvMultMat (OoqpVector &d, SymMatrix **res)
 
virtual void matMultTrans (SymMatrix **res)
 
virtual double abmaxnorm ()
 
virtual void writeToStream (std::ostream &out) const
 
virtual void symmetrize (int &info)
 
virtual int * symmetrize_set (int &info)
 
virtual void symmetrize_valonly (double *val_lower, int *goffIDX)
 
virtual void randomize (double alpha, double beta, double *seed)
 
virtual void atPutDiagonal (int idiag, OoqpVector &v)
 
virtual void fromGetDiagonal (int idiag, OoqpVector &v)
 
SparseStoragegetStorage ()
 
SparseStoragegetStorageRef ()
 
int * krowM ()
 
int * jcolM ()
 
double * M ()
 
virtual void copyMtxFromDouble (int copyLength, double *values)
 
virtual ~SparseGenMatrix ()
 
virtual void setAdditiveDiagonal (OoqpVector &diag)
 
virtual void fromGetSpRow_WithRowStart (int row, int col, double A[], int lenA, int jcolA[], int &nnz, int colExtent, int &info, int &rowStart)
 
virtual double * getMatVal ()
 
virtual void fromGetDense_withMap (int row, int col, double *A, int lda, int rowExtent, int colExtent, int const FirstCall, std::map< int, int > &ValIdxMap)
 
virtual void printMatrixInMatlab (char *name)
 
virtual void transCopyof (SparseGenMatrix &from)
 
- Public Member Functions inherited from DoubleMatrix
 DoubleMatrix ()
 
virtual ~DoubleMatrix ()
 
virtual void copyDiagonalVal_From (int idiag, OoqpVector &x, bool firstCall, std::map< int, int > &ValIdxMap)
 
- Public Member Functions inherited from IotrRefCount
int refs ()
 
 IotrRefCount ()
 

Protected Attributes

SparseStorageHandle mStorage
 
int size
 
SparseGenMatrixm_Mt
 

Additional Inherited Members

- Static Public Member Functions inherited from IotrRefCount
static void release (IotrRefCount **obj)
 
static void addRef (IotrRefCount *const *obj)
 
- Static Public Attributes inherited from IotrRefCount
static int instances = 0
 
- Protected Member Functions inherited from IotrRefCount
virtual ~IotrRefCount ()
 

Detailed Description

Represents sparse non-symmetric, possibly non-square matrices stored in row-major Harwell-Boeing format.

Constructor & Destructor Documentation

SparseGenMatrix::SparseGenMatrix ( )
SparseGenMatrix::SparseGenMatrix ( int  rows,
int  cols,
int  nnz 
)
SparseGenMatrix::SparseGenMatrix ( int  rows,
int  cols,
int  nnz,
int  krowM[],
int  jcolM[],
double  M[],
int  deleteElts = 0 
)
SparseGenMatrix::~SparseGenMatrix ( )
virtual

Member Function Documentation

double SparseGenMatrix::abmaxnorm ( )
virtual

the magnitude of the element in this matrix with largest absolute value.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::atPutDense ( int  row,
int  col,
double *  A,
int  lda,
int  rowExtent,
int  colExtent 
)
virtual

Set the value of some of the elements of this matrix.

See also
DoubleMatrix::fromGetDense

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::atPutDiagonal ( int  idiag,
OoqpVector x 
)
virtual

Set some of the diagonal elements of this matrix.

Parameters
idiagthe index of the first diagonal element to be modified.
xthe new values for the diagonal elements.

The length of x is the number of diagonal elements to be modified. Typically x will have length less than the length of the diagonal.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::atPutSpRow ( int  col,
double  A[],
int  lenA,
int  jcolA[],
int &  info 
)
virtual

Put a sparse row into this matrix.

The meaning of the parmameters is the same as in fromGetSpRow.

See also
DoubleMatrix::fromGetSpRow

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::atPutSubmatrix ( int  destRow,
int  destCol,
DoubleMatrix M,
int  srcRow,
int  srcCol,
int  rowExtent,
int  colExtent 
)
virtual

Put a submatrix of M into this matrix.

Parameters
destRowThe top row of the submatrix of M is placed at destRow.
destColThe leftmost column of the submatrix of M is placed at destCol.
srcRowThe first row of the submatrix of M is srcRow.
srcColThe first column of the submatrix of M is srcCol.
rowExtentrowExtent rows are copied from M.
colExtentcolExtent columns are copied from M.

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::ColumnScale ( OoqpVector vec)
virtual

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::copyMtxFromDouble ( int  copyLength,
double *  values 
)
virtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::fromAddDense ( int  row,
int  col,
double *  A,
int  lda,
int  rowExtent,
int  colExtent 
)
virtual

Reimplemented from DoubleMatrix.

void SparseGenMatrix::fromGetDense ( int  row,
int  col,
double *  A,
int  lda,
int  rowExtent,
int  colExtent 
)
virtual

Get the value of some of the elements of this matrix.

Parameters
rowstart reading the elements of this matrix from row number "row".
colstart reading the elements of this matrix from column number "col".
AAny array to hold the values from this matrix.
ldAthe leading dimension of A.
rowExtentget rowExtent rows from this matrix.
colExtentget colExtent columns from this matrix.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::fromGetDense_withMap ( int  row,
int  col,
double *  A,
int  lda,
int  rowExtent,
int  colExtent,
int const  FirstCall,
std::map< int, int > &  ValIdxMap 
)
virtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::fromGetDiagonal ( int  idiag,
OoqpVector x 
)
virtual

Get some of the diagonal elements of this matrix.

Parameters
idiagthe index of the first diagonal element to be read.
xa vector to hold the diagonal elements

The length of x is the number of diagonal elements to be gotten. Typically x will have length less than the length of the diagonal.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::fromGetSpRow ( int  row,
int  col,
double  A[],
int  lenA,
int  jcolA[],
int &  nnz,
int  colExtent,
int &  info 
)
virtual

Get one sparse row from this matrix.

Parameters
rowget row number "row"
colignore all elements of the row before column "col"
Astore the values of the sparse row in A
lenAthe length of A
jcolAan array of length lenA containing the column index of each element in the sparse row
colExtentignore all elements of the row that have column indices greater than or equal to col + colExtent
infoinfo is 0 if and only if the sparse row can fit into A.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::fromGetSpRow_WithRowStart ( int  row,
int  col,
double  A[],
int  lenA,
int  jcolA[],
int &  nnz,
int  colExtent,
int &  info,
int &  rowStart 
)
virtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::getDiagonal ( OoqpVector vec)
virtual

Place the diagonal elements of this matrix in the vector vec

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

virtual double* SparseGenMatrix::getMatVal ( )
inlinevirtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::getSize ( long long &  m,
long long &  n 
)
virtual

Implements DoubleMatrix.

void SparseGenMatrix::getSize ( int &  m,
int &  n 
)
virtual

Implements DoubleMatrix.

SparseStorage* SparseGenMatrix::getStorage ( )
inline
SparseStorage& SparseGenMatrix::getStorageRef ( )
inline
int SparseGenMatrix::isKindOf ( int  matrixType)
virtual

True if this matrix identifies itself to be of type matrixType.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

int* SparseGenMatrix::jcolM ( )
inlinevirtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

int* SparseGenMatrix::krowM ( )
inlinevirtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

double* SparseGenMatrix::M ( )
inlinevirtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::matMultTrans ( SymMatrix **  res)
virtual

C = this * this^T

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::matTransDinvMultMat ( OoqpVector d,
SymMatrix **  res 
)
virtual

C = this^T * inv(D) * this where D=diag(d) is a diagonal matrix.

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::matTransDMultMat ( OoqpVector d,
SymMatrix **  res 
)
virtual

C = this^T * D * this where D=diag(d) is a diagonal matrix.

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::mult ( double  beta,
OoqpVector y,
double  alpha,
OoqpVector x 
)
virtual

y = beta * y + alpha * this * x

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::mult ( double  beta,
double  y[],
int  incy,
double  alpha,
double  x[],
int  incx 
)
virtual

Reimplemented in SeqSparseGenMatrix.

int SparseGenMatrix::numberOfNonZeros ( )
virtual

The actual number of structural non-zero elements in this sparse matrix. This includes so-called "accidental" zeros, elements that are treated as non-zero even though their value happens to be zero.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::printMatrixInMatlab ( char *  name)
virtual

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::putSparseTriple ( int  irow[],
int  len,
int  jcol[],
double  A[],
int &  info 
)
virtual

Copy elements from sparse triple format into this matrix

Parameters
lenthe number of elements
irowan array containing the row number of the elements
jcolan array containing the column number of the elements
Aan array containing the values for the elements.
infoon return, info will be zero if and only if the insertion was successful.

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::randomize ( double  alpha,
double  beta,
double *  seed 
)
virtual

Fill this matrix with random elements.

Parameters
alphathe elements will be no smaller than alpha.
betathe elements will be no larger than beta.
seeda arbitrary number used to seed the random number generator.

Implements GenMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::RowScale ( OoqpVector vec)
virtual

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::scalarMult ( double  num)
virtual

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::setAdditiveDiagonal ( OoqpVector diag)
virtual

Reimplemented from DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::setToDiagonal ( OoqpVector vec)
virtual

Set the matrix to the diagoanl matrix whose diagonal is vec

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::SymmetricScale ( OoqpVector vec)
virtual

Get the number of rows and columns in the matrix

Parameters
mthe number of rows
nthe number of columns

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::symmetrize ( int &  info)
virtual

Make the elements in this matrix symmetric. The elements of interest must be in the lower triangle, and the upper triangle must be empty.

Parameters
infozero if the operation succeeded. Otherwise, insufficient space was allocated to symmetrize the matrix.

Reimplemented in SeqSparseGenMatrix.

int * SparseGenMatrix::symmetrize_set ( int &  info)
virtual
void SparseGenMatrix::symmetrize_valonly ( double *  val_lower,
int *  goffIDX 
)
virtual
void SparseGenMatrix::transCopyof ( SparseGenMatrix from)
virtual
void SparseGenMatrix::transMult ( double  beta,
OoqpVector y,
double  alpha,
OoqpVector x 
)
virtual

y = beta * y + alpha * this^T * x

Implements DoubleMatrix.

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::transMult ( double  beta,
OoqpVector y_in,
int  incy,
double  alpha,
OoqpVector x_in,
int  incx 
)
virtual

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::transMult ( double  beta,
double  y_in[],
int  incy,
double  alpha,
double  x_in[],
int  incx 
)
virtual

Reimplemented in SeqSparseGenMatrix.

void SparseGenMatrix::writeToStream ( std::ostream &  out) const
virtual

Write this element to a C++ stream

Implements DoubleMatrix.

Member Data Documentation

SparseGenMatrix* SparseGenMatrix::m_Mt
protected
SparseStorageHandle SparseGenMatrix::mStorage
protected
int SparseGenMatrix::size
protected

The documentation for this class was generated from the following files: