Inherits SparseMatrixBase.
Classes | |
class | Vector |
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, 2, 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, 2, columnMajor >::Vector &vec) | |
SparseMatrix (std::vector< typename IVSparse::SparseMatrix< T, indexT, 2, 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 * | getCounts (uint32_t vec) const |
indexT * | getIndices (uint32_t vec) const |
indexT | getNumUniqueVals (uint32_t vec) const |
indexT | getNumIndices (uint32_t vec) const |
IVSparse::SparseMatrix< T, indexT, 2, 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, 1, columnMajor > | toCSC () |
IVSparse::SparseMatrix< T, indexT, 3, columnMajor > | toIVCSC () |
Eigen::SparseMatrix< T, columnMajor ? Eigen::ColMajor :Eigen::RowMajor > | toEigen () |
Matrix Manipulation Methods | |
IVSparse::SparseMatrix< T, indexT, 2, columnMajor > | transpose () |
void | inPlaceTranspose () |
void | append (typename SparseMatrix< T, indexT, 2, columnMajor >::Vector &vec) |
std::vector< typename IVSparse::SparseMatrix< T, indexT, 2, columnMajor >::Vector > | slice (uint32_t start, uint32_t end) |
Additional Inherited Members | |
![]() | |
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 VCSC Sparse Matrix Class is a version of the CSC format. The difference is that CSC is base CSC but VCSC is CSC with run length encoding and a vector that keeps track of the number of occurances of a value in a column. This allows for fast level 1 BLAS operations and still compresses more with redundant data than CSC.
|
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, 2, columnMajor > & | other | ) |
other | The IVSparse matrix to be copied |
Deep Copy Constructor
This constructor takes in a VCSC 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 VCSC matrix. One could also take this information and convert to an Eigen Sparse Matrix and then to a VCSC 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, 2, columnMajor >::Vector & | vec | ) |
vec | The vector to construct the matrix from |
IVSparse Vector Constructor
This constructor takes in a single VCSC vector and creates a one column/row VCSC matrix.
SparseMatrix | ( | std::vector< typename IVSparse::SparseMatrix< T, indexT, 2, columnMajor >::Vector > & | vecs | ) |
vecs | The vector of VCSC vectors to construct from. |
Vector of IVSparse Vectors Constructor
This constructor takes in an vector of VCSC vectors and creates a VCSC matrix from them.
SparseMatrix | ( | const char * | filename | ) |
filename | The filepath of the matrix to be read in |
File Constructor
Given a filepath to a VCSC 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 |
vec | The vector to get the values for |
indexT * getCounts | ( | uint32_t | vec | ) | const |
vec | The vector to get the counts for |
indexT * getIndices | ( | uint32_t | vec | ) | const |
vec | The vector to get the indices for |
indexT getNumUniqueVals | ( | uint32_t | vec | ) | const |
vec | The vector to get the unique values for |
indexT getNumIndices | ( | uint32_t | vec | ) | const |
vec | The vector to get the the number of indices for |
IVSparse::SparseMatrix< T, indexT, 2, 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 .csf 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, 1, columnMajor > toCSC |
IVSparse::SparseMatrix< T, indexT, 3, columnMajor > toIVCSC |
Eigen::SparseMatrix< T, columnMajor ? Eigen::ColMajor :Eigen::RowMajor > toEigen |
IVSparse::SparseMatrix< T, indexT, 2, columnMajor > transpose |
void inPlaceTranspose |
Transposes the matrix in place instead of returning a new matrix.
void append | ( | typename SparseMatrix< T, indexT, 2, 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, 2, columnMajor >::Vector > slice | ( | uint32_t | start, |
uint32_t | end | ||
) |