miscmatrices.cpp File Reference
#include "main.h"

Functions

template<typename MatrixType >
void miscMatrices (const MatrixType &m)
 
 EIGEN_DECLARE_TEST (miscmatrices)
 

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( miscmatrices  )
39  {
40  for (int i = 0; i < g_repeat; i++) {
42  CALL_SUBTEST_2(miscMatrices(Matrix4d()));
43  CALL_SUBTEST_3(miscMatrices(MatrixXcf(3, 3)));
44  CALL_SUBTEST_4(miscMatrices(MatrixXi(8, 12)));
45  CALL_SUBTEST_5(miscMatrices(MatrixXcd(20, 20)));
46  }
47 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
void miscMatrices(const MatrixType &m)
Definition: miscmatrices.cpp:13
static int g_repeat
Definition: main.h:191
#define CALL_SUBTEST_3(FUNC)
Definition: split_test_helper.h:16
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4
#define CALL_SUBTEST_5(FUNC)
Definition: split_test_helper.h:28
#define CALL_SUBTEST_2(FUNC)
Definition: split_test_helper.h:10
#define CALL_SUBTEST_4(FUNC)
Definition: split_test_helper.h:22

References CALL_SUBTEST_1, CALL_SUBTEST_2, CALL_SUBTEST_3, CALL_SUBTEST_4, CALL_SUBTEST_5, Eigen::g_repeat, i, and miscMatrices().

◆ miscMatrices()

template<typename MatrixType >
void miscMatrices ( const MatrixType m)
13  {
14  /* this test covers the following files:
15  DiagonalMatrix.h Ones.h
16  */
17  typedef typename MatrixType::Scalar Scalar;
19  Index rows = m.rows();
20  Index cols = m.cols();
21 
22  Index r = internal::random<Index>(0, rows - 1), r2 = internal::random<Index>(0, rows - 1),
23  c = internal::random<Index>(0, cols - 1);
24  VERIFY_IS_APPROX(MatrixType::Ones(rows, cols)(r, c), static_cast<Scalar>(1));
25  MatrixType m1 = MatrixType::Ones(rows, cols);
26  VERIFY_IS_APPROX(m1(r, c), static_cast<Scalar>(1));
27  VectorType v1 = VectorType::Random(rows);
28  v1[0];
30  if (r == r2)
31  VERIFY_IS_APPROX(square(r, r2), v1[r]);
32  else
33  VERIFY_IS_MUCH_SMALLER_THAN(square(r, r2), static_cast<Scalar>(1));
35  square.diagonal() = VectorType::Ones(rows);
36  VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows));
37 }
Matrix3d m1
Definition: IOFormat.cpp:2
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13
int * m
Definition: level2_cplx_impl.h:294
#define VERIFY_IS_MUCH_SMALLER_THAN(a, b)
Definition: main.h:371
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
squared absolute sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2 square(power 2)
r
Definition: UniformPSDSelfTest.py:20
int c
Definition: calibrate.py:100
double Zero
Definition: pseudosolid_node_update_elements.cc:35
Definition: fft_test_shared.h:66

References calibrate::c, cols, m, m1, UniformPSDSelfTest::r, rows, Eigen::square(), v1(), VERIFY_IS_APPROX, VERIFY_IS_MUCH_SMALLER_THAN, and oomph::PseudoSolidHelper::Zero.

Referenced by EIGEN_DECLARE_TEST().