KrisLibrary  1.0.0
Namespaces | Functions
math/indexing.h File Reference

Utilities for matrix/vector access / manipulation with index vectors. More...

#include "VectorTemplate.h"
#include "MatrixTemplate.h"
#include "SparseVectorTemplate.h"
#include "SparseMatrixTemplate.h"
#include <vector>

Go to the source code of this file.

Namespaces

 Math
 Contains all definitions in the Math package.
 

Functions

template<class T >
void Math::SetElements (VectorTemplate< T > &A, const std::vector< int > &indices, T fill)
 Sets A[indices] = fill.
 
template<class T >
void Math::SetElements (VectorTemplate< T > &A, const std::vector< int > &indices, const VectorTemplate< T > &fill)
 Sets A[indices] = fill. More...
 
template<class T >
void Math::GetElements (const VectorTemplate< T > &A, const std::vector< int > &indices, VectorTemplate< T > &B)
 Sets B = A[indices].
 
template<class T >
void Math::CopyElements (VectorTemplate< T > &A, const std::vector< int > &aindices, const VectorTemplate< T > &B, const std::vector< int > &bindices)
 Sets A[aindices] = B[bindices].
 
template<class T >
void Math::RemoveElements (VectorTemplate< T > &A, const std::vector< int > &indices)
 Removes the indexed elements of A (shrinking A)
 
template<class T >
void Math::RemoveElements (SparseArray< T > &A, const std::vector< int > &indices)
 Removes the indexed elements of A (shrinking A)
 
template<class T >
void Math::AddElements (VectorTemplate< T > &A, const std::vector< int > &indices, T fill)
 The inverse of RemoveElements. More...
 
template<class T >
void Math::SetRows (MatrixTemplate< T > &A, const std::vector< int > &indices, T fill)
 Sets the indexed rows of A to fill.
 
template<class T >
void Math::SetElements (MatrixTemplate< T > &A, const std::vector< int > &rows, const std::vector< int > &cols, T fill)
 Sets A[r,c] = fill for all r in rows and all c in columns.
 
template<class T >
void Math::SetElements (MatrixTemplate< T > &A, const std::vector< int > &rows, const std::vector< int > &cols, const MatrixTemplate< T > &fill)
 Sets A[r,c] = fill for all r in rows and all c in columns. More...
 
template<class T >
void Math::GetElements (const MatrixTemplate< T > &A, const std::vector< int > &rows, const std::vector< int > &cols, MatrixTemplate< T > &B)
 Sets B[i,j] = A[rows[i],cols[j]] for all i and j.
 
template<class T >
void Math::CopyElements (MatrixTemplate< T > &A, const std::vector< int > &arows, const std::vector< int > &acols, const MatrixTemplate< T > &B, const std::vector< int > &brows, const std::vector< int > &bcols)
 Sets A[ar,ac] = B[br,bc] for all (ar,br) in arows x brows, (ac,bc) in acols x bcols.
 
template<class T >
void Math::RemoveElements (MatrixTemplate< T > &A, const std::vector< int > &rows, const std::vector< int > &cols)
 Removes the indexed rows and columns of A (shrinking A)
 
template<class T >
void Math::SetColumns (MatrixTemplate< T > &A, const std::vector< int > &indices, T fill)
 Sets the indexed columns of A to fill.
 
template<class T >
void Math::SetRows (MatrixTemplate< T > &A, const std::vector< int > &indices, const VectorTemplate< T > &fill)
 Sets the indexed rows of A to the vector fill.
 
template<class T >
void Math::SetColumns (MatrixTemplate< T > &A, const std::vector< int > &indices, const VectorTemplate< T > &fill)
 Sets the indexed columns of A to the vector fill.
 
template<class T >
void Math::SetRows (MatrixTemplate< T > &A, const std::vector< int > &indices, const MatrixTemplate< T > &fill)
 Sets the indexed rows of A to the columns of the matrix fill. More...
 
template<class T >
void Math::SetColumns (MatrixTemplate< T > &A, const std::vector< int > &indices, const MatrixTemplate< T > &fill)
 Sets the indexed columns of A to the columns of the matrix fill. More...
 
template<class T >
void Math::GetRows (const MatrixTemplate< T > &A, const std::vector< int > &indices, MatrixTemplate< T > &B)
 Copies the indexed rows in A into B. More...
 
template<class T >
void Math::GetColumns (const MatrixTemplate< T > &A, const std::vector< int > &indices, MatrixTemplate< T > &B)
 Copies the indexed columns in A into B. More...
 
template<class T >
void Math::RemoveRows (MatrixTemplate< T > &A, const std::vector< int > &indices)
 Removes the rows of A indexed by the sorted list indices.
 
template<class T >
void Math::RemoveColumns (MatrixTemplate< T > &A, const std::vector< int > &indices)
 Removes the columns of A indexed by the sorted indices.
 
template<class T >
void Math::RemoveRows (SparseMatrixTemplate_RM< T > &A, const std::vector< int > &indices)
 Removes the rows of A indexed by the sorted list indices.
 
template<class T >
void Math::RemoveColumns (SparseMatrixTemplate_RM< T > &A, const std::vector< int > &indices)
 Removes the columns of A indexed by the sorted indices.
 

Detailed Description

Utilities for matrix/vector access / manipulation with index vectors.

Utilities for matrix/vector stacking.

Be careful, little error checking is performed. Each index must be valid for the matrix/vector operated on.