![]() |
STAG C++
2.0.0
Spectral Toolkit of Algorithms for Graphs
|
Various helper methods for working with the STAG library.
Functions | |
std::vector< StagReal > | stag::sprsMatValues (const SprsMat *matrix) |
std::vector< StagInt > | stag::sprsMatInnerIndices (const SprsMat *matrix) |
std::vector< StagInt > | stag::sprsMatOuterStarts (const SprsMat *matrix) |
std::vector< StagReal > | stag::sprsMatToVec (const SprsMat *matrix, StagInt n) |
std::vector< StagReal > | stag::sprsMatToVec (const SprsMat *matrix) |
SprsMat | stag::sprsMatFromVectors (std::vector< StagInt > &column_starts, std::vector< StagInt > &row_indices, std::vector< StagReal > &values) |
template<typename T > | |
std::vector< T > | stag::addVectors (std::vector< T > &v1, std::vector< T > &v2) |
bool | stag::isSymmetric (const SprsMat *matrix) |
Given a sparse matrix, return the values vector, compatible with the CSC format of other libraries.
Given a sparse matrix, return the InnerIndices vector, compatible with the CSC format of other libraries.
Given a sparse matrix, return the OuterStarts vector, compatible with the CSC format of other libraries.
Given a sparse 'matrix' with only one column, convert it to a dense vector.
matrix | - the sparse vector to convert |
n | (optional) - the dimension of the dense vector to construct |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
SprsMat stag::sprsMatFromVectors | ( | std::vector< StagInt > & | column_starts, |
std::vector< StagInt > & | row_indices, | ||
std::vector< StagReal > & | values | ||
) |
Construct a sparse matrix from the CSC data vectors.
For documentation on the format of the data vectors, please see the documentation for the Eigen sparse matrix object.
This method does not perform any error checking on the provided vectors. The caller is responsible for ensuring that the provided data vectors are well-formed.
std::vector< T > stag::addVectors | ( | std::vector< T > & | v1, |
std::vector< T > & | v2 | ||
) |
Add two vectors together element-wise.
bool stag::isSymmetric | ( | const SprsMat * | matrix | ) |
Check whether a sparse matrix is symmetric.