Interfaces matrix-vector operations tailored to general sparse matrices. More...
#include <Matrices.hpp>
Public Member Functions | |
virtual returnValue | addToDiag (real_t alpha) |
sparse_int_t * | createDiagInfo () |
virtual real_t | diag (int_t i) const |
virtual Matrix * | duplicate () const |
virtual void | free () |
virtual real_t * | full () const |
virtual returnValue | getCol (int_t cNum, const Indexlist *const irows, real_t alpha, real_t *col) const |
virtual real_t | getNorm (int_t type=2) const |
virtual returnValue | getRow (int_t rNum, const Indexlist *const icols, real_t alpha, real_t *row) const |
virtual real_t | getRowNorm (int_t rNum, int_t type=2) const |
virtual returnValue | getSparseSubmatrix (int_t irowsLength, const int_t *const irowsNumber, int_t icolsLength, const int_t *const icolsNumber, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const |
virtual BooleanType | isDiag () const |
virtual returnValue | print (const char *name=0) const |
SparseMatrixRow () | |
SparseMatrixRow (int_t nr, int_t nc, sparse_int_t *r, sparse_int_t *c, real_t *v) | |
SparseMatrixRow (int_t nr, int_t nc, int_t ld, const real_t *const v) | |
virtual returnValue | times (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const |
virtual returnValue | times (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD, BooleanType yCompr=BT_TRUE) const |
virtual returnValue | transTimes (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const |
virtual returnValue | transTimes (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const |
virtual returnValue | writeToFile (FILE *output_file, const char *prefix) const |
virtual | ~SparseMatrixRow () |
Public Member Functions inherited from Matrix | |
void | doFreeMemory () |
void | doFreeMemory () |
void | doNotFreeMemory () |
void | doNotFreeMemory () |
virtual returnValue | getSparseSubmatrix (const Indexlist *const irows, const Indexlist *const icols, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const |
virtual returnValue | getSparseSubmatrix (const Indexlist *const irows, int_t idx_icol, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const |
virtual returnValue | getSparseSubmatrix (int_t idx_row, const Indexlist *const icols, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const |
Matrix () | |
Matrix () | |
BooleanType | needToFreeMemory () const |
BooleanType | needToFreeMemory () const |
virtual returnValue | print () const =0 |
virtual | ~Matrix () |
virtual | ~Matrix () |
Protected Attributes | |
sparse_int_t * | ic |
sparse_int_t * | jd |
sparse_int_t * | jr |
int_t | nCols |
int_t | nRows |
real_t * | val |
Protected Attributes inherited from Matrix | |
BooleanType | freeMemory |
Interfaces matrix-vector operations tailored to general sparse matrices.
Sparse matrix class (row compressed format).
Definition at line 782 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
SparseMatrixRow::SparseMatrixRow | ( | ) |
Default constructor.
Definition at line 1374 of file qpOASES-3.2.0/src/Matrices.cpp.
SparseMatrixRow::SparseMatrixRow | ( | int_t | nr, |
int_t | nc, | ||
sparse_int_t * | r, | ||
sparse_int_t * | c, | ||
real_t * | v | ||
) |
Constructor with arguments.
nr | Number of rows. |
nc | Number of columns. |
r | Indices to first entry of rows (nRows+1). |
c | Column indices (length). |
v | Vector of entries (length). |
Definition at line 1376 of file qpOASES-3.2.0/src/Matrices.cpp.
Constructor from dense matrix.
nr | Number of rows. |
nc | Number of columns. |
ld | Leading dimension. |
v | Row major stored matrix elements. |
Definition at line 1379 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Destructor.
Definition at line 1404 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Adds given offset to diagonal of matrix.
alpha | Diagonal offset. |
Implements Matrix.
Definition at line 1981 of file qpOASES-3.2.0/src/Matrices.cpp.
sparse_int_t * SparseMatrixRow::createDiagInfo | ( | ) |
Create jd field from ir and jc.
Definition at line 2003 of file qpOASES-3.2.0/src/Matrices.cpp.
Returns i-th diagonal entry.
i | Index. |
Implements Matrix.
Definition at line 1460 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Returns a deep-copy of the Matrix object.
Implements Matrix.
Definition at line 1430 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Frees all internal memory.
Implements Matrix.
Definition at line 1417 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Allocates and creates dense matrix array in row major format.
Note: Calling function has to free allocated memory!
Implements Matrix.
Definition at line 2021 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Retrieve indexed entries of matrix column multiplied by alpha.
cNum | Column number. |
irows | Index list specifying rows. |
alpha | Scalar factor. |
col | Output column vector. |
Implements Matrix.
Definition at line 1568 of file qpOASES-3.2.0/src/Matrices.cpp.
Get the N-norm of the matrix
type | Norm type, 1: one-norm, 2: Euclidean norm. |
Implements Matrix.
Definition at line 1494 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Retrieve indexed entries of matrix row multiplied by alpha.
rNum | Row number. |
icols | Index list specifying columns. |
alpha | Scalar factor. |
row | Output row vector. |
Implements Matrix.
Definition at line 1511 of file qpOASES-3.2.0/src/Matrices.cpp.
Get the N-norm of a row
rNum | Row number. |
type | Norm type, 1: one-norm, 2: Euclidean norm. |
Implements Matrix.
Definition at line 1503 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return.
irowsLength | Number of rows. |
irowsNumber | Array with row numbers. |
icolsLength | Number of columns. |
icolsNumber | Array with column numbers. |
rowoffset | Offset for row entries. |
coloffset | Offset for row entries. |
numNonzeros | Number of nonzeros in submatrix. |
irn | Row position of entries (as position in irows) plus rowoffset. |
jcn | Column position of entries (as position in irows) plus coloffset. |
avals | Numerical values of the entries. |
only_lower_triangular | if true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols. |
Implements Matrix.
Definition at line 1623 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Checks whether matrix is square and diagonal.
Implements Matrix.
Definition at line 1473 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Prints matrix to screen.
name | Name of matrix. |
Implements Matrix.
Definition at line 2037 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Evaluate Y=alpha*A*X + beta*Y.
xN | Number of vectors to multiply. |
alpha | Scalar factor for matrix vector product. |
x | Input vector to be multiplied. |
xLD | Leading dimension of input x. |
beta | Scalar factor for y. |
y | Output vector of results. |
yLD | Leading dimension of output y. |
Implements Matrix.
Definition at line 1634 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Evaluate matrix vector product with submatrix given by Indexlist.
irows | Index list specifying rows. |
icols | Index list specifying columns. |
xN | Number of vectors to multiply. |
alpha | Scalar factor for matrix vector product. |
x | Input vector to be multiplied. |
xLD | Leading dimension of input x. |
beta | Scalar factor for y. |
y | Output vector of results. |
yLD | Leading dimension of output y. |
yCompr | Compressed storage for y. |
Implements Matrix.
Definition at line 1710 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Evaluate Y=alpha*A'*X + beta*Y.
xN | Number of vectors to multiply. |
alpha | Scalar factor for matrix vector product. |
x | Input vector to be multiplied. |
xLD | Leading dimension of input x. |
beta | Scalar factor for y. |
y | Output vector of results. |
yLD | Leading dimension of output y. |
Implements Matrix.
Definition at line 1672 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Evaluate matrix transpose vector product.
irows | Index list specifying rows. |
icols | Index list specifying columns. |
xN | Number of vectors to multiply. |
alpha | Scalar factor for matrix vector product. |
x | Input vector to be multiplied. |
xLD | Leading dimension of input x. |
beta | Scalar factor for y. |
y | Output vector of results. |
yLD | Leading dimension of output y. |
Implements Matrix.
Definition at line 1906 of file qpOASES-3.2.0/src/Matrices.cpp.
|
virtual |
Write matrix to file.
Implements Matrix.
Definition at line 2046 of file qpOASES-3.2.0/src/Matrices.cpp.
|
protected |
Column indices (length).
Definition at line 946 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
|
protected |
Indices to first entry of upper triangle (including diagonal) (nRows).
Definition at line 947 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
|
protected |
Indices to first entry of row (nRows+1).
Definition at line 945 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
|
protected |
Number of columns.
Definition at line 944 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
|
protected |
Number of rows.
Definition at line 943 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.
|
protected |
Vector of entries (length).
Definition at line 948 of file qpOASES-3.2.0/include/qpOASES/Matrices.hpp.