Class xlifepp::RowCsStorage#

class RowCsStorage : public xlifepp::CsStorage#

Public Functions

RowCsStorage(number_t nr = 0, number_t nc = 0, string_t id = "RowCsStorage")#

default constructor

template<class L>
RowCsStorage(number_t, number_t, const std::vector<L>&, string_t id = "RowCsStorage")#

constructor by the list of col index by rows

constructor from the colNumbers (column index in cols starts at 1) cols[k] of type L stores the indices of column of non zero element on row k (index starts at 1) only requirement on L are the definition of forward const iterator named const_iterator and the size works for L = vector<number_t>, list<number_t>, set<number_t>

RowCsStorage(number_t, number_t, const std::vector<std::vector<number_t>>&, const std::vector<std::vector<number_t>>&, string_t id = "RowCsStorage")#

constructor by a pair of global numerotation vectors

constructor by a pair of numbering vectors rowNumbers and colNumbers (same size) rowNumbers[k] is the row numbers of submatrix k colNumbers[k] is the col numbers of submatrix k indices start from 1 !!!! this constructor is well adapted to FE matrix where submatrix is linked to an element

inline ~RowCsStorage()#

destructor

void addCol(number_t, const std::set<number_t>&, MatrixPart)#

add row-cols (r1,c), (r2,c), … given by a rows set (r,c>=1)

void addIndices(const std::vector<number_t>&, const std::vector<number_t>&)#

add indexes (i,j) given by rows (i) and columns (j) (i,j >= 1)

add in storage indexes (i,j) given by rows (i) and columns (j) (i,j >= 1) rows and cols are of same size

template<typename M1, typename M2, typename R>
void addMatrixMatrix(const std::vector<M1>&, const std::vector<M2>&, std::vector<R>&) const#

templated row dense Matrix + Matrix

Add two matrices.

Parameters:
  • m1 – vector values_ of first matrix

  • m2 – vector values_ of second matrix

  • r – vector values_ of result matrix

inline void addMatrixMatrix(const std::vector<real_t> &m, const std::vector<real_t> &v, std::vector<real_t> &rv) const#

Matrix+Matrix.

void addRow(number_t, const std::set<number_t>&, MatrixPart)#

add row-cols (r,c1), (r,c2), … given by a cols set (r,c>=1)

insert in storage indexes (r,c1), (r,c2), …. c1,c2, … given by cols (r,c>=1) expansive operation ! MatrixPart not managed !

void addSubMatrixIndices(const std::vector<number_t>&, const std::vector<number_t>&)#

add dense submatrix indices to storage

add submatrix indices given by its row and column indices (>= 1)

inline virtual void clear()#

clear storage vectors

inline RowCsStorage *clone() const#

create a clone (virtual copy constructor, covariant)

inline void deleteCols(number_t c1, number_t c2, std::vector<real_t> &v, SymType s)#

delete rows c1,…, c2 (may be expansive for some storage)

inline void deleteRows(number_t r1, number_t r2, std::vector<real_t> &v, SymType s)#

delete rows r1,…, r2 (may be expansive for some storage)

std::vector<std::pair<number_t, number_t>> getCol(SymType s, number_t c, number_t r1 = 1, number_t r2 = 0) const#

get (col indices, adress) of col c in set [r1,r2]

get (row indices, adress) of col c in set [r1,r2] ## SymType not used ##

std::set<number_t> getCols(number_t r, number_t c1 = 1, number_t c2 = 0) const#

get col indices of row r in set [c1,c2] (no getRows!)

get col indices of row r in set [c1,c2], specific CsRow algorithm (no getRows, use generic algorithm)

void getColsV(std::vector<number_t>&, number_t&, number_t r, number_t c1 = 1, number_t c2 = 0) const#

get col indices of row r in set [c1,c2] (no allocation!)

get col indices of row r in set [c1,c2], specific CsRow algorithm (no getRows, use generic algorithm)

std::vector<std::pair<number_t, number_t>> getRow(SymType s, number_t r, number_t c1 = 1, number_t c2 = 0) const#

get (col indices, adress) of row r in set [c1,c2]

get (col indices, adress) of row r in set [c1,c2] ## SymType not used ##

template<typename M>
void ilu(std::vector<M> &m, std::vector<M> &fa) const#

Incomplete matrix factorization with ILU.

incomplete factorization of matrix M stored as matrix F = L U where

  • L is a lower triangular matrix with unit diagonal and is stored as the strict lower triangular part of F

  • U is a upper triangular matrix with diagonal stored as diagonal part of F and strict upper triangular part stored as the strict upper triangular part of F:

inline void ilu(std::vector<real_t> &m, std::vector<real_t> &fa, const SymType sym = _noSymmetry) const#

specializations of template ILU

inline void loadFromFileDense(std::istream &ifs, std::vector<real_t> &mat, SymType sym, bool rAsC)#

load file utilities

template<typename M, typename V, typename R>
void multMatrixVector(const std::vector<M>&, const std::vector<V>&, std::vector<R>&) const#

templated row dense Matrix x Vector

template<typename M, typename V, typename R>
void multMatrixVector(const std::vector<M> &m, V *vp, R *rp) const#

templated rowcs Matrix x Vector (pointer)

template Matrix x Vector & Vector x Matrix multiplications and specializations result vector has to be sized before

inline void multMatrixVector(const std::vector<Matrix<real_t>> &m, const std::vector<Vector<real_t>> &v, std::vector<Vector<real_t>> &rv, SymType sym) const#

Matrix (Matrix) * Vector (Vector)

inline void multMatrixVector(const std::vector<real_t> &m, const std::vector<real_t> &v, std::vector<real_t> &rv, SymType sym) const#

Matrix (Scalar) * Vector (Scalar)

inline void multMatrixVector(const std::vector<real_t> &m, real_t *vp, real_t *rp, SymType sym) const#

Matrix * Vector (pointer form)

template<typename M, typename V, typename R>
void multVectorMatrix(const std::vector<M>&, const std::vector<V>&, std::vector<R>&) const#

templated Vector x row dense Matrix

template<typename M, typename V, typename R>
void multVectorMatrix(const std::vector<M> &m, V *vp, R *rp) const#

templated rowcs Vector x Matrix (pointer)

inline void multVectorMatrix(const std::vector<Matrix<real_t>> &m, const std::vector<Vector<real_t>> &v, std::vector<Vector<real_t>> &rv, SymType sym) const#

Matrix (Matrix) * Vector (Vector)

inline void multVectorMatrix(const std::vector<real_t> &m, const std::vector<real_t> &v, std::vector<real_t> &rv, SymType) const#

Vector (Scalar) * Matrix (Scalar)

inline void multVectorMatrix(const std::vector<real_t> &m, real_t *vp, real_t *rp, SymType sym) const#

Vector*Matrix (pointer form)

number_t pos(number_t i, number_t j, SymType s = _noSymmetry) const#

returns adress of entry (i,j)

void positions(const std::vector<number_t>&, const std::vector<number_t>&, std::vector<number_t>&, bool errorOn = true, SymType s = _noSymmetry) const#

access to submatrix positions

access to submatrix adresses, useful for assembling matrices rows and cols are vector of index (>0) of row and column, no index ordering is assumed !! return the vector of adresses (relative number >0 in storage) in a row storage (as Matrix) if a row or a col index is out of storage an error is raised if errorOn is true (default) position is set to 0 else if sy!=_noSymmetry only positions of lower part are requested (not used here) remark: since the vector storage indexCol_ is ordered for each line, if the indices of columns of the submatrix were also, one could write a faster algorithm

void print(std::ostream&) const#

print storage pointers

void printCooMatrix(std::ostream&, const std::vector<complex_t>&, SymType s = _noSymmetry) const#

output matrix of real scalars in coordinate form

void printCooMatrix(std::ostream&, const std::vector<Matrix<complex_t>>&, SymType s = _noSymmetry) const#

output matrix of complex scalars in coordinate form

void printCooMatrix(std::ostream&, const std::vector<Matrix<real_t>>&, SymType s = _noSymmetry) const#

output matrix of real scalars in coordinate form

void printCooMatrix(std::ostream&, const std::vector<real_t>&, SymType s = _noSymmetry) const#

output matrix of real scalars in coordinate form

print matrix to ostream in coordinate form: i j M_ij according to type of values of matrix (overload the generic method in MatrixStorage) sym is not used

void printEntries(std::ostream&, const std::vector<complex_t>&, number_t vb, const SymType sym) const#

print complex scalar matrix

void printEntries(std::ostream&, const std::vector<Matrix<complex_t>>&, number_t vb, const SymType sym) const#

print matrix of complex matrices

void printEntries(std::ostream&, const std::vector<Matrix<real_t>>&, number_t vb, const SymType sym) const#

print matrix of real matrices

void printEntries(std::ostream&, const std::vector<real_t>&, number_t vb, const SymType sym) const#

print real scalar matrix

print RowCs Storage matrix to output stream (sym is not used here)

void printEntries(std::ostream&, const std::vector<Vector<complex_t>>&, number_t vb, const SymType sym) const#

print matrix of complex vectors (not available)

void printEntries(std::ostream&, const std::vector<Vector<real_t>>&, number_t vb, const SymType sym) const#

print matrix of real vectors (not available)

large matrix of vectors are not available for the moment, use Matrix n x 1 or 1 x n

bool sameStorage(const MatrixStorage&) const#

check if two storages have the same structures

void setSizes()#

set lower/upper/diag part sizes

inline number_t size() const#

number of non zero elements stored

std::vector<number_t> skylineColPointer() const#

return skyline col pointer from current RowCsStorage

std::vector<number_t> skylineRowPointer() const#

return skyline row pointer from current RowCsStorage

bool storedPositions(std::vector<number_t> &rows, std::vector<number_t> &cols, std::vector<number_t> &adrs, SymType s = _noSymmetry) const#

list of the stored coefficients (row, col, address)

list of the stored coefficients (row index, col index, address), indices and addresses start at 1

access operator to position of (i,j)>0 coefficients (return 0 if outside) This DIRECT access to (i,j) pointer SHOULD NOT be used in matrix computation

RowCsStorage *toScalar(dimen_t nbr, dimen_t nbc)#

create a new scalar RowCs storage from current RowCs storage and submatrix sizes

template<typename M, typename OrdinalType>
void toUmfPack(const std::vector<M> &values, std::vector<OrdinalType> &colPointer, std::vector<OrdinalType> &rowIndex, std::vector<M> &mat) const#

conversion to umfpack format

template<typename M1, typename Idx>
void toUmfPack(const std::vector<M1> &m1, std::vector<Idx> &colPtUmf, std::vector<Idx> &rowIdxUmf, std::vector<M1> &resultUmf) const#

Extract and convert matrix storage to UMFPack format (Matlab sparse matrix)

Parameters:
  • m1 – vector values_ current matrix

  • colPtUmf – vector column Pointer of UMFPack format

  • rowIdxUmf – vector row Index of UMFPack format

  • resultUmf – vector values of UMFPack format

inline void toUmfPack(const std::vector<real_t> &values, std::vector<int_t> &colPointer, std::vector<int_t> &rowIndex, std::vector<real_t> &mat, const SymType sym) const#

specializations of umfpack conversion