MyraMath
|
Like SparseMatrix, but easier to populate via random access (i,j) operator. More...
#include <SparseMatrixBuilder.h>
Public Types | |
typedef std::map< int, Number > | Column |
typedef std::vector< Column > | Columns |
typedef Column::const_iterator | Iterator |
Public Member Functions | |
SparseMatrixBuilder () | |
Default constructor, makes empty SparseMatrixBuilder with size = 0x0. | |
SparseMatrixBuilder (int in_I, int in_J) | |
Constructor, requires size (I,J). Initialized to empty (contains no nonzeros). | |
SparseMatrixBuilder (std::pair< int, int > in_IJ) | |
SparseMatrixBuilder (const SparseMatrixBuilder &that) | |
Copy constructor. | |
void | swap (SparseMatrixBuilder &that) |
Member swap. | |
SparseMatrixBuilder (SparseMatrixBuilder &&that) | |
Move constructor - default construct and swap idiom. | |
SparseMatrixBuilder & | operator= (SparseMatrixBuilder that) |
Assignment operator - copy construct and swap idiom. | |
SparseMatrixBuilder & | operator= (const CSparseMatrixRange< Number > &that) |
Assignment operator from a CSparseMatrixRange. | |
SparseMatrixBuilder (const CSparseMatrixRange< Number > &that) | |
Constructs from a CSparseMatrixRange (same size, values copied) | |
SparseMatrixBuilder (InputStream &in) | |
InputStream constructor. Layout compatible with SparseMatrix. | |
void | write (OutputStream &out) const |
Writes to OutputStream. Layout compatible with SparseMatrix. | |
~SparseMatrixBuilder () | |
Releases internal resources. | |
Iterator | begin (int j) const |
Presents a const range of (i,value) pairs for j'th column. | |
Iterator | end (int j) const |
const Number & | operator() (int i, int j) const |
Random accessor. If A(i,j) is a structural zero, throws. | |
Number & | operator() (int i, int j) |
Random mutator. If A(i,j) is a structural zero, inserts a new nonzero and returns a reference to it. | |
void | erase (int i, int j) |
Removes A(i,j). Does nothing if A(i,j) is already a structural zero. | |
void | operator+= (const SparseMatrixBuilder &that) |
Adds this += that. | |
void | operator+= (const CSparseMatrixRange< Number > &that) |
void | operator-= (const SparseMatrixBuilder &that) |
Subtracts this -= that. | |
void | operator-= (const CSparseMatrixRange< Number > &that) |
void | operator*= (Number alpha) |
Scales this *= alpha. | |
void | operator/= (Number alpha) |
Scales this /= alpha. | |
bool | test (int i, int j) const |
Tests for a structural nonzero. | |
PatternBuilder | pattern () const |
Returns the nonzero Pattern of A. | |
std::vector< int > | pattern (int j) const |
Returns the (sorted) nonzero pattern of A(:,j) | |
std::pair< int, int > | size () const |
Size inspector. | |
int | n_nonzeros (int j) const |
Returns nonzero count. | |
int | n_nonzeros () const |
SparseMatrix< Number > | make_SparseMatrix () const |
Returns an equivalent SparseMatrix A. | |
Matrix< Number > | make_Matrix () const |
Returns an equivalent Matrix A. | |
Static Public Member Functions | |
static SparseMatrixBuilder< Number > | identity (int IJ) |
Generates identity SparseMatrix of specified size. | |
static SparseMatrixBuilder< Number > | random (int I, int J, int N) |
Generates a random SparseMatrix with size IxJ and (approximately) N nonzeros. | |
static SparseMatrixBuilder< Number > | random (const PatternBuilder &P) |
Generates a random SparseMatrix with the specified Pattern. | |
Like SparseMatrix, but easier to populate via random access (i,j) operator.