Class xlifepp::RowCsStorage#

class RowCsStorage : public xlifepp::CsStorage#

Inheritence diagram for xlifepp::RowCsStorage:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="xlifepp::CsStorage" tooltip="xlifepp::CsStorage"] "3" [label="xlifepp::MatrixStorage" tooltip="xlifepp::MatrixStorage"] "1" [label="xlifepp::RowCsStorage" tooltip="xlifepp::RowCsStorage" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for xlifepp::RowCsStorage:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "5" [label="std::vector< T >" tooltip="std::vector< T >"] "6" [label="std::vector< number_t >" tooltip="std::vector< number_t >"] "4" [label="std::vector< xlifepp::MatrixStorage * >" tooltip="std::vector< xlifepp::MatrixStorage * >"] "2" [label="xlifepp::CsStorage" tooltip="xlifepp::CsStorage"] "3" [label="xlifepp::MatrixStorage" tooltip="xlifepp::MatrixStorage"] "1" [label="xlifepp::RowCsStorage" tooltip="xlifepp::RowCsStorage" fillcolor="#BFBFBF"] "6" -> "5" [dir=forward tooltip="template-instance"] "4" -> "5" [dir=forward tooltip="template-instance"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "3" -> "4" [dir=forward tooltip="usage"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "1" -> "6" [dir=forward tooltip="usage"] }

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

virtual 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 virtual void addMatrixMatrix(const std::vector<real_t> &m, const std::vector<real_t> &v, std::vector<real_t> &rv) const#

Matrix+Matrix.

virtual 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 !

virtual 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 virtual RowCsStorage *clone() const#

create a clone (virtual copy constructor, covariant)

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

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

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

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

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

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

inline virtual 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 virtual void deleteRows(number_t r1, number_t r2, std::vector<complex_t> &v, SymType s)#

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

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

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

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

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

inline virtual 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)

inline virtual void fillSkylineValues(const std::vector<complex_t> &csval, std::vector<complex_t> &skyval, SymType sym, MatrixStorage *skysto) const#

fill complex values of current storage as a skyline storage

inline virtual void fillSkylineValues(const std::vector<Matrix<complex_t>> &csval, std::vector<Matrix<complex_t>> &skyval, SymType sym, MatrixStorage *skysto) const#

fill values of current storage as a skyline storage

move matrix from from current storage to an other one, return false if not available

inline virtual void fillSkylineValues(const std::vector<Matrix<real_t>> &csval, std::vector<Matrix<real_t>> &skyval, SymType sym, MatrixStorage *skysto) const#

fill values of current storage as a skyline storage

inline virtual void fillSkylineValues(const std::vector<real_t> &csval, std::vector<real_t> &skyval, SymType sym, MatrixStorage *skysto) const#

fill real values of current storage as a skyline storage

virtual 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 ##

virtual 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)

virtual 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)

virtual 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 virtual void ilu(std::vector<real_t> &m, std::vector<real_t> &fa, const SymType sym = _noSymmetry) const#

specializations of template ILU

inline virtual void loadFromFileCoo(std::istream &ifs, std::vector<complex_t> &mat, SymType sym, bool rAsC)#

load a complex coordinate matrix

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

load a real coordinate matrix

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

load a complex dense matrix from file

inline virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual 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 virtual void multVectorMatrix(const std::vector<real_t> &m, real_t *vp, real_t *rp, SymType sym) const#

Vector*Matrix (pointer form)

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

returns adress of entry (i,j)

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

virtual 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

inline virtual void print(PrintStream &os) const#

visualize storage on ostream

virtual 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

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

print complex scalar matrix

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

print matrix of complex matrices

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

print matrix of real matrices

virtual 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

virtual bool sameStorage(const MatrixStorage&) const#

check if two storages have the same structures

inline virtual number_t size() const#

number of non zero elements stored

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

return skyline col pointer from current RowCsStorage

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

return skyline row pointer from current RowCsStorage

virtual 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 virtual 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