unwind_test_impl< BaseXpr, Xpr, Depth > Struct Template Reference

Static Public Member Functions

static void run (Xpr &xpr)
 

Member Function Documentation

◆ run()

template<typename BaseXpr , typename Xpr = BaseXpr, int Depth = 0>
static void unwind_test_impl< BaseXpr, Xpr, Depth >::run ( Xpr &  xpr)
inlinestatic
326  {
327  Index startRow = internal::random<Index>(0, xpr.rows() / 5);
328  Index startCol = internal::random<Index>(0, xpr.cols() / 6);
329  Index rows = xpr.rows() / 3;
330  Index cols = xpr.cols() / 2;
331  // test equivalence of const expressions
332  const Block<const Xpr> constNestedBlock(xpr, startRow, startCol, rows, cols);
333  const Block<const BaseXpr> constUnwoundBlock = constNestedBlock.unwind();
334  VERIFY_IS_CWISE_EQUAL(constNestedBlock, constUnwoundBlock);
335  // modify a random element in each representation and test equivalence of non-const expressions
336  Block<Xpr> nestedBlock(xpr, startRow, startCol, rows, cols);
337  Block<BaseXpr> unwoundBlock = nestedBlock.unwind();
338  Index r1 = internal::random<Index>(0, rows - 1);
339  Index c1 = internal::random<Index>(0, cols - 1);
340  Index r2 = internal::random<Index>(0, rows - 1);
341  Index c2 = internal::random<Index>(0, cols - 1);
342  nestedBlock.coeffRef(r1, c1) = internal::random<typename DenseBase<Xpr>::Scalar>();
343  unwoundBlock.coeffRef(r2, c2) = internal::random<typename DenseBase<Xpr>::Scalar>();
344  VERIFY_IS_CWISE_EQUAL(nestedBlock, unwoundBlock);
345  unwind_test_impl<BaseXpr, Block<Xpr>, Depth + 1>::run(nestedBlock);
346  }
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
SCALAR Scalar
Definition: bench_gemm.cpp:45
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:110
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ConstUnwindReturnType unwind() const
Definition: Block.h:155
#define VERIFY_IS_CWISE_EQUAL(a, b)
Definition: main.h:375
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
Definition: block.cpp:325
static void run(Xpr &xpr)
Definition: block.cpp:326

References cols, rows, Eigen::Block< XprType, BlockRows, BlockCols, InnerPanel >::unwind(), and VERIFY_IS_CWISE_EQUAL.

Referenced by unwind_test().


The documentation for this struct was generated from the following file: