Inherits Eigen::SparseMatrix< double >, and RefCounter.
Libraries | |
__neg__ | |
Cols | |
returns the number of columns | |
InnerNonZeros | |
returns the nonzeros of the j-th column | |
InnerSize | |
returns the number of inner elements | |
NonZeros | |
returns the number of nonzeros | |
OuterSize | |
returns the number of sparse column vectors | |
Prune | |
sets all elements with absolute value <= reference to zero and removes from storage | |
Rows | |
returns the number of rows | |
SetZero | |
sets the object to zero (clears it) | |
Swap | |
swaps the contents of this object |
A class that represents storage for sparse linalg objects.
The storage scheme is column_major (FORTRAN). It basically provides basic features of the Eigen::SparseMatrix class, i.e. basic operators and assembly methods.
The storage scheme is described in the Eigen doc in detail. It should be noted that one can view any column_major sparse matrix as a set of 'ncols' sparse vectors. The sparse vectors are labeled by the index i ("outer iterator"), the access of the elements within these vectors is labeled by the Eigen::InnerIterator object it ("inner iterator"/ "inner loop").
The following methods can be used for storage:
(1) Sorted fill (fastest)
SparseMatrix\<double,ColMajor> m(rows,cols); m.startFill(rows*cols*percent_of_non_zero); // estimate of the number of nonzeros (optional) for (int j=0; j\<cols; ++j) for (int i=0; i\<rows; ++i) if (rand()\<percent_of_non_zero) m.fill(i,j) = rand(); m.endFill();
One has to fill the elements according to their internal index sort order (2) Fill by random inner access Herein one has to fill each outer index in its given sort order, but may fill the items into the currently active sparse vector in random order:
SparseMatrix\<double,ColMajor> m(rows,cols); m.startFill(rows*cols*percent_of_non_zero); // estimate of the number of nonzeros (optional) for (int k=0; k\<cols; ++k) for (int i=0; i\<rows*percent_of_non_zero; ++i) m.fillrand(i,rand(0,cols)) = rand(); m.endFill();
[Library] |
returns unary minus (B=-A)
overrides the sparsematrix-scalar product.
overrides the sparsematrix-densematrix product.
overrides the sparsematrix-sparsematrix sum.
overrides the sparsematrix-sparsematrix subtraction
overrides the sparsematrix-scalar division.
prints the sparse matrix up to the given rows and columns (internally a temporary dense matrix will be created)