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

Classes

struct  Wrapper< MatrixType >
 

Macros

#define TEST_ENABLE_TEMPORARY_TRACKING
 

Enumerations

enum  my_sizes { M = 12 , N = 7 }
 

Functions

template<typename MatrixType >
void ctor_init1 (const MatrixType &m)
 
 EIGEN_DECLARE_TEST (constructor)
 

Macro Definition Documentation

◆ TEST_ENABLE_TEMPORARY_TRACKING

#define TEST_ENABLE_TEMPORARY_TRACKING

Enumeration Type Documentation

◆ my_sizes

enum my_sizes
Enumerator
22 { M = 12, N = 7 };
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
@ N
Definition: constructor.cpp:22

Function Documentation

◆ ctor_init1()

template<typename MatrixType >
void ctor_init1 ( const MatrixType m)
25  {
26  // Check logic in PlainObjectBase::_init1
27  Index rows = m.rows();
28  Index cols = m.cols();
29 
30  MatrixType m0 = MatrixType::Random(rows, cols);
31 
34  VERIFY_EVALUATION_COUNT(MatrixType m2(m0.block(0, 0, rows, cols)), 1);
35 
36  Wrapper<MatrixType> wrapper(m0);
37  VERIFY_EVALUATION_COUNT(MatrixType m3(wrapper), 1);
38 }
Matrix3d m1
Definition: IOFormat.cpp:2
MatrixType m2(n_dims)
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
int * m
Definition: level2_cplx_impl.h:294
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Definition: constructor.cpp:15
#define VERIFY_EVALUATION_COUNT(XPR, N)
Definition: test/sparse_product.cpp:28

References cols, m, m1, m2(), rows, and VERIFY_EVALUATION_COUNT.

Referenced by EIGEN_DECLARE_TEST().

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( constructor  )
40  {
41  for (int i = 0; i < g_repeat; i++) {
43  CALL_SUBTEST_1(ctor_init1(Matrix4d()));
45  MatrixXcf(internal::random<int>(1, EIGEN_TEST_MAX_SIZE), internal::random<int>(1, EIGEN_TEST_MAX_SIZE))));
47  MatrixXi(internal::random<int>(1, EIGEN_TEST_MAX_SIZE), internal::random<int>(1, EIGEN_TEST_MAX_SIZE))));
48  }
49  {
51  VERIFY_IS_EQUAL(a[0], 123);
52  }
53  {
54  Matrix<Index, 1, 1> a(123.0);
55  VERIFY_IS_EQUAL(a[0], 123);
56  }
57  {
59  VERIFY_IS_EQUAL(a[0], 123.f);
60  }
61  {
62  Array<Index, 1, 1> a(123);
63  VERIFY_IS_EQUAL(a[0], 123);
64  }
65  {
66  Array<Index, 1, 1> a(123.0);
67  VERIFY_IS_EQUAL(a[0], 123);
68  }
69  {
70  Array<float, 1, 1> a(123);
71  VERIFY_IS_EQUAL(a[0], 123.f);
72  }
73  {
74  Array<Index, 3, 3> a(123);
75  VERIFY_IS_EQUAL(a(4), 123);
76  }
77  {
78  Array<Index, 3, 3> a(123.0);
79  VERIFY_IS_EQUAL(a(4), 123);
80  }
81  {
82  Array<float, 3, 3> a(123);
83  VERIFY_IS_EQUAL(a(4), 123.f);
84  }
85  {
86  MatrixXi m1(M, N);
87  VERIFY_IS_EQUAL(m1.rows(), M);
88  VERIFY_IS_EQUAL(m1.cols(), N);
89  ArrayXXi a1(M, N);
90  VERIFY_IS_EQUAL(a1.rows(), M);
91  VERIFY_IS_EQUAL(a1.cols(), N);
92  VectorXi v1(M);
93  VERIFY_IS_EQUAL(v1.size(), M);
94  ArrayXi a2(M);
95  VERIFY_IS_EQUAL(a2.size(), M);
96  }
97 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9;Map< RowVectorXf > v1(M1.data(), M1.size())
#define EIGEN_TEST_MAX_SIZE
Definition: boostmultiprec.cpp:16
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:48
void ctor_init1(const MatrixType &m)
Definition: constructor.cpp:25
const Scalar * a
Definition: level2_cplx_impl.h:32
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
static int g_repeat
Definition: main.h:191
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4

References a, CALL_SUBTEST_1, ctor_init1(), EIGEN_TEST_MAX_SIZE, Eigen::g_repeat, i, m1, N, v1(), and VERIFY_IS_EQUAL.