Inherits SparseMatrixBase.
Classes | |
class | InnerIterator |
class | Vector |
Public Member Functions | |
Constructors | |
SparseMatrix () | |
SparseMatrix (Eigen::SparseMatrix< T > &mat) | |
SparseMatrix (Eigen::SparseMatrix< T, Eigen::RowMajor > &mat) | |
template<uint8_t compressionLevel2> | |
SparseMatrix (IVSparse::SparseMatrix< T, indexT, compressionLevel2, columnMajor > &other) | |
SparseMatrix (const IVSparse::SparseMatrix< T, indexT, 1, columnMajor > &other) | |
template<typename T2 , typename indexT2 > | |
SparseMatrix (T2 *vals, indexT2 *innerIndices, indexT2 *outerPtr, uint32_t num_rows, uint32_t num_cols, uint32_t nnz) | |
template<typename T2 , typename indexT2 > | |
SparseMatrix (std::vector< std::tuple< indexT2, indexT2, T2 >> &entries, uint32_t num_rows, uint32_t num_cols, uint32_t nnz) | |
SparseMatrix (typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector &vec) | |
SparseMatrix (std::vector< typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector > &vecs) | |
SparseMatrix (const char *filename) | |
~SparseMatrix () | |
Getters | |
T | coeff (uint32_t row, uint32_t col) |
bool | isColumnMajor () const |
T * | getValues (uint32_t vec) const |
indexT * | getInnerIndices (uint32_t vec) const |
indexT * | getOuterPointers () const |
IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector | getVector (uint32_t vec) |
Calculations | |
std::vector< T > | outerSum () |
std::vector< T > | innerSum () |
std::vector< T > | maxColCoeff () |
std::vector< T > | maxRowCoeff () |
std::vector< T > | minColCoeff () |
std::vector< T > | minRowCoeff () |
T | trace () |
T | sum () |
double | norm () |
double | vectorLength (uint32_t vec) |
Utility Methods | |
void | write (const char *filename) |
void | print () |
IVSparse::SparseMatrix< T, indexT, 2, columnMajor > | toVCSC () |
IVSparse::SparseMatrix< T, indexT, 3, columnMajor > | toIVCSC () |
Eigen::SparseMatrix< T, columnMajor ? Eigen::ColMajor :Eigen::RowMajor > | toEigen () |
Matrix Manipulation Methods | |
IVSparse::SparseMatrix< T, indexT, 1, columnMajor > | transpose () |
void | inPlaceTranspose () |
void | append (typename SparseMatrix< T, indexT, 1, columnMajor >::Vector &vec) |
std::vector< typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector > | slice (uint32_t start, uint32_t end) |
![]() | |
template<typename T > | |
T | coeff (uint32_t row, uint32_t col) |
uint32_t | rows () const |
uint32_t | cols () const |
uint32_t | innerSize () const |
uint32_t | outerSize () const |
uint32_t | nonZeros () const |
size_t | byteSize () const |
The CSC Sparse Matrix Class is a version of the CSC format and is the most basic version of the IVSparse format. Mostly used for ease of use with other compression levels and with other libraries. This is a good baseline to compare against the other compression levels as well.
|
inline |
Construct an empty IVSparse matrix
The matrix will have 0 rows and 0 columns and will not be initialized with any values. All data will be set to nullptr.
SparseMatrix | ( | Eigen::SparseMatrix< T > & | mat | ) |
mat | The Eigen Sparse Matrix to be compressed |
Eigen Sparse Matrix Constructor
This constructor takes an Eigen Sparse Matrix and compresses it into a IVSparse matrix.
SparseMatrix | ( | Eigen::SparseMatrix< T, Eigen::RowMajor > & | mat | ) |
mat | The Eigen Sparse Matrix to be compressed |
Eigen Sparse Matrix Constructor (Row Major)
Same as previous constructor but for Row Major Eigen Sparse Matrices.
SparseMatrix | ( | IVSparse::SparseMatrix< T, indexT, compressionLevel2, columnMajor > & | other | ) |
compressionLevel2 | The compression level of the IVSparse matrix to convert |
mat | The IVSparse matrix to convert |
Convert a IVSparse matrix of a different compression level to this compression level.
This constructor takes in a IVSparse matrix of the same storage order, value, and index type and converts it to a different compresion level. This is useful for converting between compression levels without having to go through the CSC format.
SparseMatrix | ( | const IVSparse::SparseMatrix< T, indexT, 1, columnMajor > & | other | ) |
other | The IVSparse matrix to be copied |
Deep Copy Constructor
This constructor takes in a IVSparse matrix and creates a deep copy of it.
SparseMatrix | ( | T2 * | vals, |
indexT2 * | innerIndices, | ||
indexT2 * | outerPtr, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols, | ||
uint32_t | nnz | ||
) |
Raw CSC Constructor
This constructor takes in raw CSC storage format pointers and converts it to a IVSparse matrix. One could also take this information and convert to an Eigen Sparse Matrix and then to a IVSparse matrix.
SparseMatrix | ( | std::vector< std::tuple< indexT2, indexT2, T2 >> & | entries, |
uint32_t | num_rows, | ||
uint32_t | num_cols, | ||
uint32_t | nnz | ||
) |
COO Tuples Constructor
This constructor takes in a list of tuples in COO format which can be unsorted but without duplicates. The tuples are sorted and then converted to a IVSparse matrix.
SparseMatrix | ( | typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector & | vec | ) |
vec | The vector to construct the matrix from |
IVSparse Vector Constructor
This constructor takes in a single IVSparse vector and creates a one column/row IVSparse matrix.
SparseMatrix | ( | std::vector< typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector > & | vecs | ) |
vecs | The vector of IVSparse vectors to construct from. |
Vector of IVSparse Vectors Constructor
This constructor takes in an vector of IVSparse vectors and creates a IVSparse matrix from them.
SparseMatrix | ( | const char * | filename | ) |
filename | The filepath of the matrix to be read in |
File Constructor
Given a filepath to a IVSparse matrix written to file this constructor will read in the matrix and construct it.
T coeff | ( | uint32_t | row, |
uint32_t | col | ||
) |
Get the value at the specified row and column
bool isColumnMajor |
See the storage order of the IVSparse matrix.
T * getValues | ( | uint32_t | vec | ) | const |
indexT * getInnerIndices | ( | uint32_t | vec | ) | const |
indexT * getOuterPointers |
SparseMatrix< T, indexT, 1, columnMajor >::Vector getVector | ( | uint32_t | vec | ) |
vec | The vector to get a copy of |
Get a copy of a IVSparse vector from the IVSparse matrix such as the first column.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
filename | The filename of the matrix to write to |
This method writes the IVSparse matrix to a file in binary format. This can then be read in later using the file constructor. Currently .ivs is the perfered file extension.
Implements SparseMatrixBase.
|
virtual |
Prints "IVSparse Matrix:" followed by the dense representation of the matrix to the console.
Implements SparseMatrixBase.
IVSparse::SparseMatrix< T, indexT, 2, columnMajor > toVCSC |
IVSparse::SparseMatrix< T, indexT, 3, columnMajor > toIVCSC |
Eigen::SparseMatrix< T, columnMajor ? Eigen::ColMajor :Eigen::RowMajor > toEigen |
IVSparse::SparseMatrix< T, indexT, 1, columnMajor > transpose |
void inPlaceTranspose |
Transposes the matrix in place instead of returning a new matrix.
void append | ( | typename SparseMatrix< T, indexT, 1, columnMajor >::Vector & | vec | ) |
vec | The vector to append to the matrix in the correct storage order. |
Appends a IVSparse vector to the current matrix in the storage order of the matrix.
std::vector< typename IVSparse::SparseMatrix< T, indexT, 1, columnMajor >::Vector > slice | ( | uint32_t | start, |
uint32_t | end | ||
) |