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

Macros

#define TEST_ENABLE_TEMPORARY_TRACKING
 

Typedefs

typedef NestByValue< MatrixXd > CpyMatrixXd
 
typedef CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXdXprType
 

Functions

XprType get_xpr_with_temps (const MatrixXd &a)
 
 EIGEN_DECLARE_TEST (nestbyvalue)
 

Macro Definition Documentation

◆ TEST_ENABLE_TEMPORARY_TRACKING

#define TEST_ENABLE_TEMPORARY_TRACKING

Typedef Documentation

◆ CpyMatrixXd

typedef NestByValue<MatrixXd> CpyMatrixXd

◆ XprType

typedef CwiseBinaryOp<internal::scalar_sum_op<double, double>, const CpyMatrixXd, const CpyMatrixXd> XprType

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( nestbyvalue  )
23  {
24  for (int i = 0; i < g_repeat; i++) {
25  Index rows = internal::random<Index>(1, EIGEN_TEST_MAX_SIZE);
26  Index cols = internal::random<Index>(1, EIGEN_TEST_MAX_SIZE);
27  MatrixXd a = MatrixXd::Random(rows, cols);
28  nb_temporaries = 0;
31  MatrixXd b = x;
33  VERIFY_IS_APPROX(b, a.rowwise().reverse().eval() + (a + a).eval());
34  // Block expressions work with dense NestByValue.
35  VERIFY_IS_APPROX(b, a.nestByValue().rowwise().reverse().eval() + (a.nestByValue() + a.nestByValue()).eval());
36  }
37 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar * b
Definition: benchVecAdd.cpp:17
#define EIGEN_TEST_MAX_SIZE
Definition: boostmultiprec.cpp:16
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13
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
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
list x
Definition: plotDoE.py:28
XprType get_xpr_with_temps(const MatrixXd &a)
Definition: nestbyvalue.cpp:17
static long int nb_temporaries
Definition: sparse_permutations.cpp:21

References a, b, cols, EIGEN_TEST_MAX_SIZE, Eigen::g_repeat, get_xpr_with_temps(), i, nb_temporaries, rows, VERIFY_IS_APPROX, VERIFY_IS_EQUAL, and plotDoE::x.

◆ get_xpr_with_temps()

XprType get_xpr_with_temps ( const MatrixXd &  a)
17  {
18  MatrixXd t1 = a.rowwise().reverse();
19  MatrixXd t2 = a + a;
20  return t1.nestByValue() + t2.nestByValue();
21 }

References a.

Referenced by EIGEN_DECLARE_TEST().