10 #include <CTraitsTest.h>    11 #include <gtest/gtest.h>    14 #include <Eigen/Dense>    20 template class mrpt::CTraitsTest<mrpt::math::CSparseMatrix>;
    30     for (
size_t i = 0; i < nEntries; i++)
    52     EXPECT_TRUE(dense_out == dense1) << 
"Failed with N=" << N << 
"\n";
    55 TEST(SparseMatrix, InitFromDenseUnit)
    69     EXPECT_TRUE(dense_out == dense1) << 
"Failed with N=" << N << 
"\n";
    72 TEST(SparseMatrix, InitFromDenseRandom)
    79 TEST(SparseMatrix, InitFromTriplet)
   103 TEST(SparseMatrix, InitFromSparse)
   118                                 << dense_out << endl;
   121 TEST(SparseMatrix, InitFromRandom)
   134     size_t nRows1, 
size_t nCols1, 
size_t nNonZeros1, 
size_t nRows2,
   143     (*op1)(SM1, SM2, SM_res);
   154     const double err = (RES - Dres).array().abs().
maxCoeff();
   158                              << D2 << 
"Real op result:\n"   159                              << RES << 
"SM result:\n"   198 TEST(SparseMatrix, Op_Multiply_AB)
   212 TEST(SparseMatrix, CholeskyDecomp)
 Scalar maxCoeff() const
Maximum value in the matrix/vector. 
 
MATRIX drawDefinitePositiveMatrix(const size_t dim, const double std_scale=1.0, const double diagonal_epsilon=1e-8)
Generates a random definite-positive matrix of the given size, using the formula C = v*v^t + epsilon*...
 
void setColCount(const size_t nCols)
 
EXPECT_TRUE(mrpt::system::fileExists(ini_fil))
 
void do_matrix_op_test(size_t nRows1, size_t nCols1, size_t nNonZeros1, size_t nRows2, size_t nCols2, size_t nNonZeros2, TMatrixSMOperator op1, TMatrixDenseOperator op2)
 
bool chol(Derived &U) const
Cholesky M=UT * U decomposition for symmetric matrix (upper-half of the matrix is actually ignored...
 
void drawGaussian1DMatrix(MAT &matrix, const double mean=0, const double std=1)
Fills the given matrix with independent, 1D-normally distributed samples. 
 
Auxiliary class to hold the results of a Cholesky factorization of a sparse matrix. 
 
bool isSquare() const
returns true if matrix is NxN 
 
A sparse matrix structure, wrapping T. 
 
void compressFromTriplet()
ONLY for TRIPLET matrices: convert the matrix in a column-compressed form. 
 
void(*)(const CMatrixDouble &M1, const CMatrixDouble &M2, CMatrixDouble &res) TMatrixDenseOperator
 
void op_dense_multiply_AB(const CMatrixDouble &M1, const CMatrixDouble &M2, CMatrixDouble &res)
 
void insert_entry(const size_t row, const size_t col, const double val)
@ Access the matrix, get, set elements, etc. 
 
A sparse matrix container (with cells of any type), with iterators. 
 
CMatrixDouble get_L() const
Return the L matrix (L*L' = M), as a dense matrix. 
 
void get_dense(CMatrixDouble &outMat) const
Return a dense representation of the sparse matrix. 
 
This base provides a set of functions for maths stuff. 
 
void op_sparse_multiply_AB(const CSparseMatrix &M1, const CSparseMatrix &M2, CSparseMatrix &res)
 
void do_test_init_to_unit(size_t N)
 
TEST(SparseMatrix, InitFromDenseUnit)
 
void do_test_init_random(size_t N)
 
void setRowCount(const size_t nRows)
Change the number of rows in the matrix (can't be lower than current size) 
 
void clear(const size_t nRows=1, const size_t nCols=1)
Erase all previous contents and leave the matrix as a "triplet" ROWS x COLS matrix without any nonzer...
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
void op_dense_add(const CMatrixDouble &M1, const CMatrixDouble &M2, CMatrixDouble &res)
 
void insert_submatrix(const size_t row, const size_t col, const MATRIX &M)
ONLY for TRIPLET matrices: insert a given matrix (in any of the MRPT formats) at a given location of ...
 
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications. 
 
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object. 
 
void op_sparse_add(const CSparseMatrix &M1, const CSparseMatrix &M2, CSparseMatrix &res)
 
void(*)(const CSparseMatrix &M1, const CSparseMatrix &M2, CSparseMatrix &res) TMatrixSMOperator
 
void generateRandomSparseMatrix(size_t N, size_t M, size_t nEntries, CSparseMatrix &MAT)