SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::testing::SparseMatrixTest< TReal > Struct Template Reference

#include <SparseMatrixTest.h>

Inheritance diagram for sofa::testing::SparseMatrixTest< TReal >:

Static Public Member Functions

template<int EigenSparseMatrixOptions>
static void generateRandomSparseMatrix (Eigen::SparseMatrix< TReal, EigenSparseMatrixOptions > &eigenMatrix, Eigen::Index nbRows, Eigen::Index nbCols, TReal sparsity)
 
template<class InputIt >
static void generateFromTriplets (Eigen::SparseMatrix< TReal > &eigenMatrix, InputIt first, InputIt last, Eigen::Index nbRows, Eigen::Index nbCols)
 
template<typename _DstScalar , int _DstOptions, typename _DstStorageIndex , typename _SrcScalar , int _SrcOptions, typename _SrcStorageIndex >
static void copyFromEigen (Eigen::SparseMatrix< _DstScalar, _DstOptions, _DstStorageIndex > &dst, const Eigen::SparseMatrix< _SrcScalar, _SrcOptions, _SrcStorageIndex > &src)
 
static void copyFromEigen (linearalgebra::BaseMatrix &dst, const Eigen::SparseMatrix< TReal > &src)
 
template<typename _AScalar , int _AOptions, typename _AStorageIndex , typename _BScalar , int _BOptions, typename _BStorageIndex >
static bool compareSparseMatrix (const Eigen::SparseMatrix< _AScalar, _AOptions, _AStorageIndex > &A, const Eigen::SparseMatrix< _BScalar, _BOptions, _BStorageIndex > &B)
 
template<typename _AScalar , int _AOptions, typename _AStorageIndex , typename _BScalar , int _BOptions, typename _BStorageIndex >
static bool compareEigenSparseMatrix (const Eigen::SparseMatrix< _AScalar, _AOptions, _AStorageIndex > &A, const Eigen::SparseMatrix< _BScalar, _BOptions, _BStorageIndex > &B)
 
- Static Public Member Functions inherited from sofa::testing::NumericTest< SReal >
static Real matrixMaxDiff (const Matrix1 &m1, const Matrix2 &m2)
 return the maximum difference between corresponding entries, or the infinity if the matrices have different sizes More...
 
static Real matrixMaxDiff (const sofa::type::Mat< M, N, Real > &m1, const Matrix2 &m2)
 Return the maximum difference between corresponding entries, or the infinity if the matrices have different sizes. More...
 
static Real epsilon ()
 the smallest real number More...
 
static Real infinity ()
 Infinity. More...
 
static bool isSmall (Real r, Real ratio=1.)
 true if the magnitude of r is less than ratio*epsilon More...
 
static Real vectorMaxDiff (const sofa::type::Vec< N, Real > &m1, const Vector2 &m2)
 return the maximum difference between corresponding entries, or the infinity if the vectors have different sizes More...
 
static Real vectorMaxDiff (const sofa::type::Vec< N, Real > &m1, const sofa::type::Vec< N, Real > &m2)
 return the maximum difference between corresponding entries More...
 

Additional Inherited Members

- Public Attributes inherited from sofa::testing::BaseTest
sofa::testing::MessageAsTestFailure m_fatal
 
sofa::testing::MessageAsTestFailure m_error
 
- Static Public Attributes inherited from sofa::testing::BaseTest
static int seed = (unsigned int)time(nullptr)
 Seed value. More...
 
- Public Member Functions inherited from sofa::testing::NumericTest< SReal >
 NumericTest ()
 
Real vectorMaxDiff (const Container1 &c1, const Container2 &c2)
 Return the maximum difference between two containers. Issues a failure if sizes are different. More...
 
Real vectorMaxAbs (const Container &c)
 Return the maximum absolute value of a container. More...
 
- Public Member Functions inherited from sofa::testing::BaseTest
 BaseTest ()
 Initialize Sofa and the random number generator. More...
 
 ~BaseTest () override
 
virtual void onSetUp ()
 
virtual void onTearDown ()
 
- Static Protected Member Functions inherited from sofa::testing::NumericTest< SReal >
static float norm (float a)
 
static double norm (double a)
 
static Real norm (T a)
 

Function details

◆ compareEigenSparseMatrix()

template<typename TReal = SReal>
template<typename _AScalar , int _AOptions, typename _AStorageIndex , typename _BScalar , int _BOptions, typename _BStorageIndex >
static bool sofa::testing::SparseMatrixTest< TReal >::compareEigenSparseMatrix ( const Eigen::SparseMatrix< _AScalar, _AOptions, _AStorageIndex > &  A,
const Eigen::SparseMatrix< _BScalar, _BOptions, _BStorageIndex > &  B 
)
inlinestatic

◆ compareSparseMatrix()

template<typename TReal = SReal>
template<typename _AScalar , int _AOptions, typename _AStorageIndex , typename _BScalar , int _BOptions, typename _BStorageIndex >
static bool sofa::testing::SparseMatrixTest< TReal >::compareSparseMatrix ( const Eigen::SparseMatrix< _AScalar, _AOptions, _AStorageIndex > &  A,
const Eigen::SparseMatrix< _BScalar, _BOptions, _BStorageIndex > &  B 
)
inlinestatic

◆ copyFromEigen() [1/2]

template<typename TReal = SReal>
template<typename _DstScalar , int _DstOptions, typename _DstStorageIndex , typename _SrcScalar , int _SrcOptions, typename _SrcStorageIndex >
static void sofa::testing::SparseMatrixTest< TReal >::copyFromEigen ( Eigen::SparseMatrix< _DstScalar, _DstOptions, _DstStorageIndex > &  dst,
const Eigen::SparseMatrix< _SrcScalar, _SrcOptions, _SrcStorageIndex > &  src 
)
inlinestatic

◆ copyFromEigen() [2/2]

template<typename TReal = SReal>
static void sofa::testing::SparseMatrixTest< TReal >::copyFromEigen ( linearalgebra::BaseMatrix dst,
const Eigen::SparseMatrix< TReal > &  src 
)
inlinestatic

◆ generateFromTriplets()

template<typename TReal = SReal>
template<class InputIt >
static void sofa::testing::SparseMatrixTest< TReal >::generateFromTriplets ( Eigen::SparseMatrix< TReal > &  eigenMatrix,
InputIt  first,
InputIt  last,
Eigen::Index  nbRows,
Eigen::Index  nbCols 
)
inlinestatic

◆ generateRandomSparseMatrix()

template<typename TReal = SReal>
template<int EigenSparseMatrixOptions>
static void sofa::testing::SparseMatrixTest< TReal >::generateRandomSparseMatrix ( Eigen::SparseMatrix< TReal, EigenSparseMatrixOptions > &  eigenMatrix,
Eigen::Index  nbRows,
Eigen::Index  nbCols,
TReal  sparsity 
)
inlinestatic

Generate a sparse matrix of size nbRows x nbCols. The sparsity is the ratio of non-zero values compared to the total size of the matrix (= nbRows x nbCols).