36 #include <ringmesh/ringmesh_tests_config.h> 38 #include <geogram/basic/string.h> 49 matrix.set_element( 0, 0, 1. );
50 matrix.set_element( 1, 1, 1. );
51 matrix.set_element( 2, 2, 1. );
52 for( index_t i = 0; i < matrix.
ni(); ++i )
56 std::tie( exists, elt ) = matrix.get_element( i, i );
57 if( !exists || std::abs( elt - 1. ) > global_epsilon )
60 ") should exist and be correct!" );
62 for( index_t j = 0; j < matrix.
nj(); ++j )
66 std::tie( exists, std::ignore ) = matrix.get_element( i, j );
70 ",", i,
") should not exist!" );
79 matrix.set_element( 0, 1, 3. );
82 std::tie( exists, elt ) = matrix.get_element( 0, 1 );
83 if( !exists || std::abs( elt - 3. ) > global_epsilon )
86 "TEST",
"Matrix element at (0,1) should exist and be correct!" );
90 std::tie( exists, elt ) = matrix.get_element( 1, 0 );
91 if( !exists || std::abs( elt - 3. ) > global_epsilon )
94 "Matrix element at (1,0) should exist and be correct!" );
99 std::tie( exists, elt ) = matrix.get_element( 1, 0 );
103 "TEST",
"Matrix element at (1,0) should not exist!" );
109 const std::vector< double >& product_result )
111 std::vector< double > vect_to_multiply = { 5., 2., 9. };
112 std::vector< double > result =
113 product_matrix_by_vector< double >( matrix, vect_to_multiply );
114 if( std::abs( result[0] - product_result[0] ) > global_epsilon
115 || std::abs( result[1] - product_result[1] ) > global_epsilon
116 || std::abs( result[2] - product_result[2] ) > global_epsilon )
123 const std::vector< double >& product_result )
134 std::vector< double > product_result = { 11., 17., 9. };
138 product_result[1] = 2.;
158 catch(
const std::exception& e )
void set_get_test(SparseMatrix< double, light > &matrix)
static void err(const std::string &feature, const Args &... args)
static void out(const std::string &feature, const Args &... args)
void symmetry_test(SparseMatrix< double, light > &matrix)
void one_test_sequence(SparseMatrix< double, light > &matrix, const std::vector< double > &product_result)
const std::string & category() const
void build_matrix(index_t ni, index_t nj)
Classes to build GeoModel from various inputs.
bool is_symmetrical() const
void product_by_vector_test(SparseMatrix< double, light > &matrix, const std::vector< double > &product_result)
void RINGMESH_API default_configure()