![]() |
CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
|
The sparse matrix class (coordinate format). More...

Constructors | |
| XxMatrix () | |
| Default constructor. | |
| XxMatrix (T_Int nr, T_Int nc, const Property &pr=Property::General()) | |
| Dimension constructor. | |
| XxMatrix (const XxMatrix< T_Int, T_Scalar > &other)=default | |
| Copy constructor. | |
| XxMatrix (XxMatrix< T_Int, T_Scalar > &&other)=default | |
| Move constructor. | |
| ~XxMatrix () | |
| Destructor. | |
Operators | |
| XxMatrix< T_Int, T_Scalar > & | operator= (const XxMatrix< T_Int, T_Scalar > &other)=default |
| Copy assignment operator. | |
| XxMatrix< T_Int, T_Scalar > & | operator= (XxMatrix< T_Int, T_Scalar > &&other)=default |
| Move assignment operator. | |
Arguments | |
| T_Int | nnz () const |
| Get the number of non-zero elements. | |
Public Member Functions | |
| void | clear () |
| Clear the sparse matrix. | |
| void | reserve (T_Int nz) |
| Reserve storage for non-zero elements. | |
| void | insert (const Tuple< T_Int, T_Scalar > &tuple) |
| Insert a non-zero element using a tuple. | |
| void | insert (T_Int i, T_Int j, T_Scalar v) |
| Insert a non-zero element. | |
| std::string | info (const std::string &header="") const |
| Get information about the sparse matrix. | |
| void | toStream (std::ostream &os, std::streamsize prec=0) const |
| Output the sparse matrix to a stream. | |
| csc::XxMatrix< T_Int, T_Scalar > | toCsc (dup_t duplicatePolicy=dup_t::Sum) const |
| Convert to compressed sparse column (CSC) format. | |
| csr::XxMatrix< T_Int, T_Scalar > | toCsr (dup_t duplicatePolicy=dup_t::Sum) const |
| Convert to compressed sparse row (CSR) format. | |
Additional Inherited Members | |
| Public Member Functions inherited from cla3p::MatrixMeta< T_Int > | |
| const Property & | prop () const |
| Matrix property accessor. | |
| Public Member Functions inherited from cla3p::Meta2D< T_Int > | |
| virtual T_Int | nrows () const |
| Number of rows. | |
| virtual T_Int | ncols () const |
| Number of columns. | |
| bool | empty () const |
| Tests whether the object has zero dimensions. | |
| operator bool () const | |
| Boolean conversion operator. | |
The sparse matrix class (coordinate format).
| cla3p::coo::XxMatrix< T_Int, T_Scalar >::XxMatrix | ( | ) |
Default constructor.
Creates an empty sparse matrix with no allocated memory.
|
explicit |
Dimension constructor.
Creates a sparse matrix of the specified dimensions in coordinate format.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | pr | The matrix property (default: General). |
|
default |
Copy constructor.
Creates a new sparse matrix by copying another sparse matrix.
| [in] | other | The sparse matrix to copy. |
|
default |
Move constructor.
Creates a new sparse matrix by moving resources from another sparse matrix.
| [in] | other | The sparse matrix to move from. |
| cla3p::coo::XxMatrix< T_Int, T_Scalar >::~XxMatrix | ( | ) |
Destructor.
Destroys the sparse matrix and releases allocated memory.
|
default |
Copy assignment operator.
Copies the contents of another sparse matrix to this sparse matrix.
| [in] | other | The sparse matrix to copy. |
|
default |
Move assignment operator.
Moves resources from another sparse matrix to this sparse matrix.
| [in] | other | The sparse matrix to move from. |
| T_Int cla3p::coo::XxMatrix< T_Int, T_Scalar >::nnz | ( | ) | const |
Get the number of non-zero elements.
Returns the number of stored non-zero elements in the sparse matrix.
| void cla3p::coo::XxMatrix< T_Int, T_Scalar >::clear | ( | ) |
Clear the sparse matrix.
Releases all memory and resets the matrix to an empty state.
| void cla3p::coo::XxMatrix< T_Int, T_Scalar >::reserve | ( | T_Int | nz | ) |
Reserve storage for non-zero elements.
Preallocates memory for the specified number of non-zero elements to avoid reallocations.
| [in] | nz | The number of non-zero elements to reserve space for. |
| void cla3p::coo::XxMatrix< T_Int, T_Scalar >::insert | ( | const Tuple< T_Int, T_Scalar > & | tuple | ) |
Insert a non-zero element using a tuple.
Inserts a non-zero element specified as a tuple (row, column, value) into the sparse matrix.
| [in] | tuple | The tuple containing the row index, column index, and value. |
| void cla3p::coo::XxMatrix< T_Int, T_Scalar >::insert | ( | T_Int | i, |
| T_Int | j, | ||
| T_Scalar | v ) |
Insert a non-zero element.
Inserts a non-zero element at the specified row and column with the given value.
| [in] | i | The row index. |
| [in] | j | The column index. |
| [in] | v | The value to insert. |
| std::string cla3p::coo::XxMatrix< T_Int, T_Scalar >::info | ( | const std::string & | header = "" | ) | const |
Get information about the sparse matrix.
Returns a string containing information about the matrix's dimensions, non-zeros, and properties.
| [in] | header | Optional header string to prepend to the information. |
| void cla3p::coo::XxMatrix< T_Int, T_Scalar >::toStream | ( | std::ostream & | os, |
| std::streamsize | prec = 0 ) const |
Output the sparse matrix to a stream.
Writes the sparse matrix elements to the specified output stream with specified precision.
| [in,out] | os | The output stream to write to. |
| [in] | prec | The output precision (default: 0 for default precision). |
| csc::XxMatrix< T_Int, T_Scalar > cla3p::coo::XxMatrix< T_Int, T_Scalar >::toCsc | ( | dup_t | duplicatePolicy = dup_t::Sum | ) | const |
Convert to compressed sparse column (CSC) format.
Converts the coordinate format sparse matrix to CSC format.
| [in] | duplicatePolicy | The policy for handling duplicate entries (default: Sum). |
| csr::XxMatrix< T_Int, T_Scalar > cla3p::coo::XxMatrix< T_Int, T_Scalar >::toCsr | ( | dup_t | duplicatePolicy = dup_t::Sum | ) | const |
Convert to compressed sparse row (CSR) format.
Converts the coordinate format sparse matrix to CSR format.
| [in] | duplicatePolicy | The policy for handling duplicate entries (default: Sum). |