STAG C++  2.0.0
Spectral Toolkit of Algorithms for Graphs
Loading...
Searching...
No Matches
utility.h File Reference

Description

Various helper methods for working with the STAG library.

Functions

std::vector< StagRealstag::sprsMatValues (const SprsMat *matrix)
 
std::vector< StagIntstag::sprsMatInnerIndices (const SprsMat *matrix)
 
std::vector< StagIntstag::sprsMatOuterStarts (const SprsMat *matrix)
 
std::vector< StagRealstag::sprsMatToVec (const SprsMat *matrix, StagInt n)
 
std::vector< StagRealstag::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)
 

Function Documentation

◆ sprsMatValues()

std::vector< StagReal > stag::sprsMatValues ( const SprsMat matrix)

Given a sparse matrix, return the values vector, compatible with the CSC format of other libraries.

◆ sprsMatInnerIndices()

std::vector< StagInt > stag::sprsMatInnerIndices ( const SprsMat matrix)

Given a sparse matrix, return the InnerIndices vector, compatible with the CSC format of other libraries.

◆ sprsMatOuterStarts()

std::vector< StagInt > stag::sprsMatOuterStarts ( const SprsMat matrix)

Given a sparse matrix, return the OuterStarts vector, compatible with the CSC format of other libraries.

◆ sprsMatToVec() [1/2]

std::vector< StagReal > stag::sprsMatToVec ( const SprsMat matrix,
StagInt  n 
)

Given a sparse 'matrix' with only one column, convert it to a dense vector.

Parameters
matrix- the sparse vector to convert
n(optional) - the dimension of the dense vector to construct
Returns
a vector

◆ sprsMatToVec() [2/2]

std::vector< StagReal > stag::sprsMatToVec ( const SprsMat matrix)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ sprsMatFromVectors()

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.

◆ addVectors()

template<typename T >
std::vector< T > stag::addVectors ( std::vector< T > &  v1,
std::vector< T > &  v2 
)

Add two vectors together element-wise.

◆ isSymmetric()

bool stag::isSymmetric ( const SprsMat matrix)

Check whether a sparse matrix is symmetric.