ATSuite C++  v1.0
Scientific C++ routines originally developed by Alexis Tantet
Typedefs | Functions
atmatrix.hpp File Reference

Matrix manipulation. More...

#include <vector>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_vector_int.h>
#include <gsl/gsl_matrix.h>
#include <Eigen/Dense>
#include <Eigen/Sparse>

Go to the source code of this file.

Typedefs

typedef Eigen::SparseMatrix< double, Eigen::RowMajor > SpMatCSR
 Eigen CSR matrix of double type.
 
typedef Eigen::SparseMatrix< int, Eigen::RowMajor > SpMatIntCSR
 Eigen CSR matrix of integer type.
 
typedef Eigen::SparseMatrix< double, Eigen::ColMajor > SpMatCSC
 Eigen CSC matrix of double type.
 
typedef Eigen::SparseMatrix< bool, Eigen::ColMajor > SpMatCSCBool
 Eigen CSC matrix of boolean type.
 

Functions

gsl_vector * getRowSum (SpMatCSR *T)
 Get the sum of each row of an Eigen CSR matrix. More...
 
void getRowSum (SpMatCSR *T, gsl_vector *rowSum)
 Get the sum of each row of an Eigen CSR matrix. More...
 
gsl_vector_int * getRowSum (SpMatIntCSR *T)
 Get the sum of each row of an Eigen CSR matrix of integer type. More...
 
gsl_vector * getColSum (SpMatCSR *T)
 Get the sum of each column of an Eigen CSR matrix. More...
 
void getColSum (SpMatCSR *T, gsl_vector *colSum)
 Get the sum of each column of an Eigen CSR matrix. More...
 
gsl_vector * getColSum (SpMatCSC *T)
 Get the sum of each column of an Eigen CSC matrix. More...
 
double getSum (SpMatCSR *T)
 Returns a the sum of the elements of an Eigen CSR matrix. More...
 
double sumVectorElements (gsl_vector *v)
 Returns a the sum of the elements of an GSL vector. More...
 
void normalizeVector (gsl_vector *v)
 Normalize a GSL vector by the sum of its elements. More...
 
void normalizeRows (SpMatCSR *T, gsl_vector *rowSum)
 Normalize each row of an Eigen CSR matrix by a GSL vector. More...
 
SpMatCSCBoolcwiseGT (SpMatCSC *T, double ref)
 Perform an element-wise greater than test on an Eigen CSC matrix. More...
 
SpMatCSCBoolcwiseLT (SpMatCSC *T, double ref)
 Perform an element-wise lower than test on an Eigen CSC matrix. More...
 
bool any (SpMatCSCBool *T)
 Perform an any operation on an Eigen CSC matrix of boolean type. More...
 
double max (SpMatCSC *T)
 Finds the maximum element of an Eigen CSC matrix. More...
 
double min (SpMatCSC *T)
 Finds the minimum element of an Eigen CSC matrix. More...
 
std::vector< int > * argmax (SpMatCSC *T)
 Finds the position of the maximum element of an Eigen CSC matrix. More...
 
std::vector< int > * argmin (SpMatCSC *T)
 Finds the position of the minimum element of an Eigen CSC matrix. More...
 

Detailed Description

ATSuite matrix manipulation routines.

Definition in file atmatrix.hpp.

Function Documentation

bool any ( SpMatCSCBool T)

Perform an any operation on an Eigen CSC matrix of boolean type.

Parameters
[in]TEigen CSC matrix of boolean type on which to any.
Returns
True if any, False otherwise.

Definition at line 300 of file atmatrix.hpp.

std::vector< int > * argmax ( SpMatCSC T)

Finds the position of the maximum element of an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix from which to find the maximum.
Returns
Vector of the indices of the maximum of the matrix.

Definition at line 363 of file atmatrix.hpp.

std::vector< int > * argmin ( SpMatCSC T)

Finds the position of the minimum element of an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix from which to find the minimum.
Returns
Vector of the indices of the minimum of the matrix.

Definition at line 390 of file atmatrix.hpp.

SpMatCSCBool * cwiseGT ( SpMatCSC T,
double  ref 
)

Perform an element-wise greater than test on an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix to test.
[in]refScalar against which to compare.
Returns
Eigen CSC matrix of boolean type resulting from the test.

Definition at line 261 of file atmatrix.hpp.

SpMatCSCBool * cwiseLT ( SpMatCSC T,
double  ref 
)

Perform an element-wise lower than test on an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix to test.
[in]refScalar against which to compare.
Returns
Eigen CSC matrix of boolean type resulting from the test.

Definition at line 281 of file atmatrix.hpp.

gsl_vector * getColSum ( SpMatCSR T)

Get the sum of each column of an Eigen CSR matrix as a GSL vector.

Parameters
[in]TEigen CSR matrix on which to sum.
Returns
GSL vector of the sum of columns of the sparse matrix.

Definition at line 119 of file atmatrix.hpp.

Referenced by Grid::~Grid().

void getColSum ( SpMatCSR T,
gsl_vector *  colSum 
)

Get the sum of each column of an Eigen CSR matrix as a GSL vector (alternate version with output in argument).

Parameters
[in]TEigen CSR matrix on which to sum.
[out]colSumGSL vector of the sum of columns of the sparse matrix.

Definition at line 142 of file atmatrix.hpp.

gsl_vector * getColSum ( SpMatCSC T)

Get the sum of each column of an Eigen CSC matrix as a GSL vector.

Parameters
[in]TEigen CSC matrix on which to sum.
Returns
GSL vector of the sum of columns of the sparse matrix.

Definition at line 164 of file atmatrix.hpp.

gsl_vector * getRowSum ( SpMatCSR T)

Get the sum of each row of an Eigen CSR matrix as a GSL vector.

Parameters
[in]TEigen CSR matrix on which to sum.
Returns
GSL vector of the sum of the rows of the sparse matrix.

Definition at line 56 of file atmatrix.hpp.

Referenced by toRightStochastic(), and Grid::~Grid().

void getRowSum ( SpMatCSR T,
gsl_vector *  rowSum 
)

Get the sum of each row of an Eigen CSR matrix as a GSL vector (alternate version with output as argument).

Parameters
[in]TEigen CSR matrix on which to sum.
[out]rowSumGSL vector of the sum of rows of the sparse matrix.

Definition at line 78 of file atmatrix.hpp.

gsl_vector_int * getRowSum ( SpMatIntCSR T)

Get the sum of each row of an Eigen CSR matrix of integer type as a GSL vector.

Parameters
[in]TEigen CSR matrix of integer type on which to sum.
Returns
Integer GSL vector of the sum of rows of the sparse matrix.

Definition at line 99 of file atmatrix.hpp.

double getSum ( SpMatCSR T)

Returns a the sum over all the elements of an Eigen CSR matrix.

Parameters
[in]TEigen CSR matrix on which to sum.
Returns
Sum over all the elements of the sparse matrix.

Definition at line 184 of file atmatrix.hpp.

Referenced by toAndStochastic().

double max ( SpMatCSC T)

Finds the maximum element of an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix from which to find the maximum.
Returns
Value of the maximum.

Definition at line 319 of file atmatrix.hpp.

double min ( SpMatCSC T)

Finds the minimum element of an Eigen CSC matrix.

Parameters
[in]TEigen CSC matrix from which to find the minimum.
Returns
Value of the minimum.

Definition at line 341 of file atmatrix.hpp.

void normalizeRows ( SpMatCSR T,
gsl_vector *  rowSum 
)

Normalize each row of an Eigen CSR matrix by each element of a GSL vector.

Parameters
[in]TEigen CSR matrix to normalize.
[in]rowSumGSL vector used to normalize the rows of the sparse matrix.

Definition at line 240 of file atmatrix.hpp.

Referenced by toRightStochastic().

void normalizeVector ( gsl_vector *  v)

Normalize a GSL vector by the sum of its elements.

Parameters
[in]vGSL vector to normalize.

Definition at line 222 of file atmatrix.hpp.

References sumVectorElements().

Referenced by filterTransitionMatrix(), and Grid::~Grid().

double sumVectorElements ( gsl_vector *  v)

Returns a the sum over all the elements of an GSL vector.

Parameters
[in]vGSL vector over which to sum.
Returns
Sum over all the elements of the vector.

Definition at line 205 of file atmatrix.hpp.

Referenced by normalizeVector().