product_small.cpp File Reference
#include "product.h"
#include <Eigen/LU>

Functions

template<int >
void product1x1 ()
 
template<typename TC , typename TA , typename TB >
const TC & ref_prod (TC &C, const TA &A, const TB &B)
 
template<typename T , int Rows, int Cols, int Depth, int OC, int OA, int OB>
std::enable_if_t<!((Rows==1 &&Depth !=1 &&OA==ColMajor)||(Depth==1 &&Rows !=1 &&OA==RowMajor)||(Cols==1 &&Depth !=1 &&OB==RowMajor)||(Depth==1 &&Cols !=1 &&OB==ColMajor)||(Rows==1 &&Cols !=1 &&OC==ColMajor)||(Cols==1 &&Rows !=1 &&OC==RowMajor)), void > test_lazy_single (int rows, int cols, int depth)
 
void test_dynamic_bool ()
 
template<typename T , int Rows, int Cols, int Depth, int OC, int OA, int OB>
std::enable_if_t<((Rows==1 &&Depth !=1 &&OA==ColMajor)||(Depth==1 &&Rows !=1 &&OA==RowMajor)||(Cols==1 &&Depth !=1 &&OB==RowMajor)||(Depth==1 &&Cols !=1 &&OB==ColMajor)||(Rows==1 &&Cols !=1 &&OC==ColMajor)||(Cols==1 &&Rows !=1 &&OC==RowMajor)), void > test_lazy_single (int, int, int)
 
template<typename T , int Rows, int Cols, int Depth>
void test_lazy_all_layout (int rows=Rows, int cols=Cols, int depth=Depth)
 
template<typename T >
void test_lazy_l1 ()
 
template<typename T >
void test_lazy_l2 ()
 
template<typename T >
void test_lazy_l3 ()
 
template<typename T , int N, int M, int K>
void test_linear_but_not_vectorizable ()
 
template<int Rows>
void bug_1311 ()
 
template<int >
void product_small_regressions ()
 
template<typename T >
void product_sweep (int max_m, int max_k, int max_n)
 
 EIGEN_DECLARE_TEST (product_small)
 

Function Documentation

◆ bug_1311()

template<int Rows>
void bug_1311 ( )
227  {
229  A.setRandom();
230  Vector2d b = Vector2d::Random();
232  res.noalias() = 1. * (A * b);
233  VERIFY_IS_APPROX(res, A * b);
234  res.noalias() = 1. * A * b;
235  VERIFY_IS_APPROX(res, A * b);
236  res.noalias() = (1. * A).lazyProduct(b);
237  VERIFY_IS_APPROX(res, A * b);
238  res.noalias() = (1. * A).lazyProduct(1. * b);
239  VERIFY_IS_APPROX(res, A * b);
240  res.noalias() = (A).lazyProduct(1. * b);
241  VERIFY_IS_APPROX(res, A * b);
242 }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
Scalar * b
Definition: benchVecAdd.cpp:17
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Derived & setRandom(Index size)
Definition: Random.h:147
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13

References b, res, Eigen::PlainObjectBase< Derived >::setRandom(), and VERIFY_IS_APPROX.

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( product_small  )
297  {
298  for (int i = 0; i < g_repeat; i++) {
302  CALL_SUBTEST_3(product(Matrix3d()));
303  CALL_SUBTEST_4(product(Matrix4d()));
304  CALL_SUBTEST_5(product(Matrix4f()));
306  CALL_SUBTEST_6(product1x1<0>());
307 
308  CALL_SUBTEST_11(test_lazy_l1<float>());
309  CALL_SUBTEST_12(test_lazy_l2<float>());
310  CALL_SUBTEST_13(test_lazy_l3<float>());
311 
312  CALL_SUBTEST_21(test_lazy_l1<double>());
313  CALL_SUBTEST_22(test_lazy_l2<double>());
314  CALL_SUBTEST_23(test_lazy_l3<double>());
315 
316  CALL_SUBTEST_31(test_lazy_l1<std::complex<float> >());
317  CALL_SUBTEST_32(test_lazy_l2<std::complex<float> >());
318  CALL_SUBTEST_33(test_lazy_l3<std::complex<float> >());
319 
320  CALL_SUBTEST_41(test_lazy_l1<std::complex<double> >());
321  CALL_SUBTEST_42(test_lazy_l2<std::complex<double> >());
322  CALL_SUBTEST_43(test_lazy_l3<std::complex<double> >());
323 
324  CALL_SUBTEST_7((test_linear_but_not_vectorizable<float, 2, 1, Dynamic>()));
325  CALL_SUBTEST_7((test_linear_but_not_vectorizable<float, 3, 1, Dynamic>()));
326  CALL_SUBTEST_7((test_linear_but_not_vectorizable<float, 2, 1, 16>()));
327 
328  CALL_SUBTEST_6(bug_1311<3>());
329  CALL_SUBTEST_6(bug_1311<5>());
330 
332 
333  // Commonly specialized vectorized types.
334  CALL_SUBTEST_50(product_sweep<float>(10, 10, 10));
335  CALL_SUBTEST_51(product_sweep<double>(10, 10, 10));
336  CALL_SUBTEST_52(product_sweep<Eigen::half>(10, 10, 10));
337  CALL_SUBTEST_53(product_sweep<Eigen::bfloat16>(10, 10, 10));
338  }
339 
340  CALL_SUBTEST_6(product_small_regressions<0>());
341 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
static int g_repeat
Definition: main.h:191
void product(const MatrixType &m)
Definition: product.h:42
void test_dynamic_bool()
Definition: product_small.cpp:53
void test_lazy_l3()
Definition: product_small.cpp:160
void test_lazy_l1()
Definition: product_small.cpp:97
void test_lazy_l2()
Definition: product_small.cpp:125
#define CALL_SUBTEST_21(FUNC)
Definition: split_test_helper.h:124
#define CALL_SUBTEST_32(FUNC)
Definition: split_test_helper.h:190
#define CALL_SUBTEST_33(FUNC)
Definition: split_test_helper.h:196
#define CALL_SUBTEST_6(FUNC)
Definition: split_test_helper.h:34
#define CALL_SUBTEST_3(FUNC)
Definition: split_test_helper.h:16
#define CALL_SUBTEST_42(FUNC)
Definition: split_test_helper.h:250
#define CALL_SUBTEST_31(FUNC)
Definition: split_test_helper.h:184
#define CALL_SUBTEST_50(FUNC)
Definition: split_test_helper.h:298
#define CALL_SUBTEST_53(FUNC)
Definition: split_test_helper.h:316
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4
#define CALL_SUBTEST_51(FUNC)
Definition: split_test_helper.h:304
#define CALL_SUBTEST_13(FUNC)
Definition: split_test_helper.h:76
#define CALL_SUBTEST_8(FUNC)
Definition: split_test_helper.h:46
#define CALL_SUBTEST_5(FUNC)
Definition: split_test_helper.h:28
#define CALL_SUBTEST_11(FUNC)
Definition: split_test_helper.h:64
#define CALL_SUBTEST_12(FUNC)
Definition: split_test_helper.h:70
#define CALL_SUBTEST_52(FUNC)
Definition: split_test_helper.h:310
#define CALL_SUBTEST_2(FUNC)
Definition: split_test_helper.h:10
#define CALL_SUBTEST_7(FUNC)
Definition: split_test_helper.h:40
#define CALL_SUBTEST_23(FUNC)
Definition: split_test_helper.h:136
#define CALL_SUBTEST_4(FUNC)
Definition: split_test_helper.h:22
#define CALL_SUBTEST_43(FUNC)
Definition: split_test_helper.h:256
#define CALL_SUBTEST_9(FUNC)
Definition: split_test_helper.h:52
#define CALL_SUBTEST_10(FUNC)
Definition: split_test_helper.h:58
#define CALL_SUBTEST_22(FUNC)
Definition: split_test_helper.h:130
#define CALL_SUBTEST_41(FUNC)
Definition: split_test_helper.h:244

References CALL_SUBTEST_1, CALL_SUBTEST_10, CALL_SUBTEST_11, CALL_SUBTEST_12, CALL_SUBTEST_13, CALL_SUBTEST_2, CALL_SUBTEST_21, CALL_SUBTEST_22, CALL_SUBTEST_23, CALL_SUBTEST_3, CALL_SUBTEST_31, CALL_SUBTEST_32, CALL_SUBTEST_33, CALL_SUBTEST_4, CALL_SUBTEST_41, CALL_SUBTEST_42, CALL_SUBTEST_43, CALL_SUBTEST_5, CALL_SUBTEST_50, CALL_SUBTEST_51, CALL_SUBTEST_52, CALL_SUBTEST_53, CALL_SUBTEST_6, CALL_SUBTEST_7, CALL_SUBTEST_8, CALL_SUBTEST_9, Eigen::g_repeat, i, product(), test_dynamic_bool(), test_lazy_l1(), test_lazy_l2(), and test_lazy_l3().

◆ product1x1()

template<int >
void product1x1 ( )
15  {
16  Matrix<float, 1, 3> matAstatic;
17  Matrix<float, 3, 1> matBstatic;
18  matAstatic.setRandom();
19  matBstatic.setRandom();
20  VERIFY_IS_APPROX((matAstatic * matBstatic).coeff(0, 0), matAstatic.cwiseProduct(matBstatic.transpose()).sum());
21 
22  MatrixXf matAdynamic(1, 3);
23  MatrixXf matBdynamic(3, 1);
24  matAdynamic.setRandom();
25  matBdynamic.setRandom();
26  VERIFY_IS_APPROX((matAdynamic * matBdynamic).coeff(0, 0), matAdynamic.cwiseProduct(matBdynamic.transpose()).sum());
27 }

References Eigen::PlainObjectBase< Derived >::setRandom(), and VERIFY_IS_APPROX.

◆ product_small_regressions()

template<int >
void product_small_regressions ( )
245  {
246  {
247  // test compilation of (outer_product) * vector
248  Vector3f v = Vector3f::Random();
249  VERIFY_IS_APPROX((v * v.transpose()) * v, (v * v.transpose()).eval() * v);
250  }
251 
252  {
253  // regression test for pull-request #93
255  A.setRandom();
257  B.setRandom();
259  C.setRandom();
260  VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]);
261  VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C);
262  }
263 
264  {
266  A.setRandom();
267  C = A;
268  for (int k = 0; k < 79; ++k) C = C * A;
269  B.noalias() =
270  (((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) *
271  ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A))) *
272  (((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) *
273  ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)) * ((A * A) * (A * A)));
274  VERIFY_IS_APPROX(B, C);
275  }
276 }
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:49
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:48
Definition: matrices.h:74
char char char int int * k
Definition: level2_impl.h:374

References k, Eigen::PlainObjectBase< Derived >::setRandom(), v, and VERIFY_IS_APPROX.

◆ product_sweep()

template<typename T >
void product_sweep ( int  max_m,
int  max_k,
int  max_n 
)
279  {
281  for (int m = 1; m < max_m; ++m) {
282  for (int n = 1; n < max_n; ++n) {
283  Matrix C = Matrix::Zero(m, n);
284  Matrix Cref = Matrix::Zero(m, n);
285  for (int k = 1; k < max_k; ++k) {
286  Matrix A = Matrix::Random(m, k);
287  Matrix B = Matrix::Random(k, n);
288  C = A * B;
289  Cref.setZero();
290  ref_prod(Cref, A, B);
291  VERIFY_IS_APPROX(C, Cref);
292  }
293  }
294  }
295 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
int * m
Definition: level2_cplx_impl.h:294
double Zero
Definition: pseudosolid_node_update_elements.cc:35
const TC & ref_prod(TC &C, const TA &A, const TB &B)
Definition: product_small.cpp:30

References k, m, n, ref_prod(), Eigen::PlainObjectBase< Derived >::setZero(), VERIFY_IS_APPROX, and oomph::PseudoSolidHelper::Zero.

◆ ref_prod()

template<typename TC , typename TA , typename TB >
const TC& ref_prod ( TC &  C,
const TA &  A,
const TB &  B 
)
30  {
31  for (Index i = 0; i < C.rows(); ++i)
32  for (Index j = 0; j < C.cols(); ++j)
33  for (Index k = 0; k < A.cols(); ++k) C.coeffRef(i, j) += A.coeff(i, k) * B.coeff(k, j);
34  return C;
35 }
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References Eigen::PlainObjectBase< Derived >::coeff(), Eigen::PlainObjectBase< Derived >::cols(), i, j, and k.

Referenced by product_sweep(), and test_lazy_single().

◆ test_dynamic_bool()

void test_dynamic_bool ( )
53  {
54  int rows = internal::random<int>(1, 64);
55  int cols = internal::random<int>(1, 64);
56  int depth = internal::random<int>(1, 65);
57 
58  typedef Matrix<bool, Dynamic, Dynamic> MatrixX;
59  MatrixX A(rows, depth);
60  A.setRandom();
61  MatrixX B(depth, cols);
62  B.setRandom();
63  MatrixX C(rows, cols);
64  C.setRandom();
65  MatrixX D(C);
66  for (Index i = 0; i < C.rows(); ++i)
67  for (Index j = 0; j < C.cols(); ++j)
68  for (Index k = 0; k < A.cols(); ++k) D.coeffRef(i, j) |= (A.coeff(i, k) && B.coeff(k, j));
69  C += A * B;
71 
72  MatrixX E = B.transpose();
73  for (Index i = 0; i < B.rows(); ++i)
74  for (Index j = 0; j < B.cols(); ++j) VERIFY_IS_EQUAL(B(i, j), E(j, i));
75 }
dominoes D
Definition: Domino.cpp:55
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68

References Eigen::PlainObjectBase< Derived >::coeff(), cols, Eigen::PlainObjectBase< Derived >::cols(), D, Global_Physical_Variables::E, i, j, k, rows, Eigen::PlainObjectBase< Derived >::setRandom(), and VERIFY_IS_EQUAL.

Referenced by EIGEN_DECLARE_TEST().

◆ test_lazy_all_layout()

template<typename T , int Rows, int Cols, int Depth>
void test_lazy_all_layout ( int  rows = Rows,
int  cols = Cols,
int  depth = Depth 
)
85  {
86  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, ColMajor, ColMajor, ColMajor>(rows, cols, depth)));
87  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, RowMajor, ColMajor, ColMajor>(rows, cols, depth)));
88  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, ColMajor, RowMajor, ColMajor>(rows, cols, depth)));
89  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, RowMajor, RowMajor, ColMajor>(rows, cols, depth)));
90  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, ColMajor, ColMajor, RowMajor>(rows, cols, depth)));
91  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, RowMajor, ColMajor, RowMajor>(rows, cols, depth)));
92  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, ColMajor, RowMajor, RowMajor>(rows, cols, depth)));
93  CALL_SUBTEST((test_lazy_single<T, Rows, Cols, Depth, RowMajor, RowMajor, RowMajor>(rows, cols, depth)));
94 }
#define CALL_SUBTEST(FUNC)
Definition: main.h:382

References CALL_SUBTEST, cols, and rows.

◆ test_lazy_l1()

template<typename T >
void test_lazy_l1 ( )
97  {
98  int rows = internal::random<int>(1, 12);
99  int cols = internal::random<int>(1, 12);
100  int depth = internal::random<int>(1, 12);
101 
102  // Inner
103  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, 1>()));
104  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, 2>()));
105  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, 3>()));
106  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, 8>()));
107  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, 9>()));
108  CALL_SUBTEST((test_lazy_all_layout<T, 1, 1, -1>(1, 1, depth)));
109 
110  // Outer
111  CALL_SUBTEST((test_lazy_all_layout<T, 2, 1, 1>()));
112  CALL_SUBTEST((test_lazy_all_layout<T, 1, 2, 1>()));
113  CALL_SUBTEST((test_lazy_all_layout<T, 2, 2, 1>()));
114  CALL_SUBTEST((test_lazy_all_layout<T, 3, 3, 1>()));
115  CALL_SUBTEST((test_lazy_all_layout<T, 4, 4, 1>()));
116  CALL_SUBTEST((test_lazy_all_layout<T, 4, 8, 1>()));
117  CALL_SUBTEST((test_lazy_all_layout<T, 4, -1, 1>(4, cols)));
118  CALL_SUBTEST((test_lazy_all_layout<T, 7, -1, 1>(7, cols)));
119  CALL_SUBTEST((test_lazy_all_layout<T, -1, 8, 1>(rows)));
120  CALL_SUBTEST((test_lazy_all_layout<T, -1, 3, 1>(rows)));
121  CALL_SUBTEST((test_lazy_all_layout<T, -1, -1, 1>(rows, cols)));
122 }

References CALL_SUBTEST, cols, and rows.

Referenced by EIGEN_DECLARE_TEST().

◆ test_lazy_l2()

template<typename T >
void test_lazy_l2 ( )
125  {
126  int rows = internal::random<int>(1, 12);
127  int cols = internal::random<int>(1, 12);
128  int depth = internal::random<int>(1, 12);
129 
130  // mat-vec
131  CALL_SUBTEST((test_lazy_all_layout<T, 2, 1, 2>()));
132  CALL_SUBTEST((test_lazy_all_layout<T, 2, 1, 4>()));
133  CALL_SUBTEST((test_lazy_all_layout<T, 4, 1, 2>()));
134  CALL_SUBTEST((test_lazy_all_layout<T, 4, 1, 4>()));
135  CALL_SUBTEST((test_lazy_all_layout<T, 5, 1, 4>()));
136  CALL_SUBTEST((test_lazy_all_layout<T, 4, 1, 5>()));
137  CALL_SUBTEST((test_lazy_all_layout<T, 4, 1, 6>()));
138  CALL_SUBTEST((test_lazy_all_layout<T, 6, 1, 4>()));
139  CALL_SUBTEST((test_lazy_all_layout<T, 8, 1, 8>()));
140  CALL_SUBTEST((test_lazy_all_layout<T, -1, 1, 4>(rows)));
141  CALL_SUBTEST((test_lazy_all_layout<T, 4, 1, -1>(4, 1, depth)));
142  CALL_SUBTEST((test_lazy_all_layout<T, -1, 1, -1>(rows, 1, depth)));
143 
144  // vec-mat
145  CALL_SUBTEST((test_lazy_all_layout<T, 1, 2, 2>()));
146  CALL_SUBTEST((test_lazy_all_layout<T, 1, 2, 4>()));
147  CALL_SUBTEST((test_lazy_all_layout<T, 1, 4, 2>()));
148  CALL_SUBTEST((test_lazy_all_layout<T, 1, 4, 4>()));
149  CALL_SUBTEST((test_lazy_all_layout<T, 1, 5, 4>()));
150  CALL_SUBTEST((test_lazy_all_layout<T, 1, 4, 5>()));
151  CALL_SUBTEST((test_lazy_all_layout<T, 1, 4, 6>()));
152  CALL_SUBTEST((test_lazy_all_layout<T, 1, 6, 4>()));
153  CALL_SUBTEST((test_lazy_all_layout<T, 1, 8, 8>()));
154  CALL_SUBTEST((test_lazy_all_layout<T, 1, -1, 4>(1, cols)));
155  CALL_SUBTEST((test_lazy_all_layout<T, 1, 4, -1>(1, 4, depth)));
156  CALL_SUBTEST((test_lazy_all_layout<T, 1, -1, -1>(1, cols, depth)));
157 }

References CALL_SUBTEST, cols, and rows.

Referenced by EIGEN_DECLARE_TEST().

◆ test_lazy_l3()

template<typename T >
void test_lazy_l3 ( )
160  {
161  int rows = internal::random<int>(1, 12);
162  int cols = internal::random<int>(1, 12);
163  int depth = internal::random<int>(1, 12);
164  // mat-mat
165  CALL_SUBTEST((test_lazy_all_layout<T, 2, 4, 2>()));
166  CALL_SUBTEST((test_lazy_all_layout<T, 2, 6, 4>()));
167  CALL_SUBTEST((test_lazy_all_layout<T, 4, 3, 2>()));
168  CALL_SUBTEST((test_lazy_all_layout<T, 4, 8, 4>()));
169  CALL_SUBTEST((test_lazy_all_layout<T, 5, 6, 4>()));
170  CALL_SUBTEST((test_lazy_all_layout<T, 4, 2, 5>()));
171  CALL_SUBTEST((test_lazy_all_layout<T, 4, 7, 6>()));
172  CALL_SUBTEST((test_lazy_all_layout<T, 6, 8, 4>()));
173  CALL_SUBTEST((test_lazy_all_layout<T, 8, 3, 8>()));
174  CALL_SUBTEST((test_lazy_all_layout<T, -1, 6, 4>(rows)));
175  CALL_SUBTEST((test_lazy_all_layout<T, 4, 3, -1>(4, 3, depth)));
176  CALL_SUBTEST((test_lazy_all_layout<T, -1, 6, -1>(rows, 6, depth)));
177  CALL_SUBTEST((test_lazy_all_layout<T, 8, 2, 2>()));
178  CALL_SUBTEST((test_lazy_all_layout<T, 5, 2, 4>()));
179  CALL_SUBTEST((test_lazy_all_layout<T, 4, 4, 2>()));
180  CALL_SUBTEST((test_lazy_all_layout<T, 8, 4, 4>()));
181  CALL_SUBTEST((test_lazy_all_layout<T, 6, 5, 4>()));
182  CALL_SUBTEST((test_lazy_all_layout<T, 4, 4, 5>()));
183  CALL_SUBTEST((test_lazy_all_layout<T, 3, 4, 6>()));
184  CALL_SUBTEST((test_lazy_all_layout<T, 2, 6, 4>()));
185  CALL_SUBTEST((test_lazy_all_layout<T, 7, 8, 8>()));
186  CALL_SUBTEST((test_lazy_all_layout<T, 8, -1, 4>(8, cols)));
187  CALL_SUBTEST((test_lazy_all_layout<T, 3, 4, -1>(3, 4, depth)));
188  CALL_SUBTEST((test_lazy_all_layout<T, 4, -1, -1>(4, cols, depth)));
189 }

References CALL_SUBTEST, cols, and rows.

Referenced by EIGEN_DECLARE_TEST().

◆ test_lazy_single() [1/2]

template<typename T , int Rows, int Cols, int Depth, int OC, int OA, int OB>
std::enable_if_t<!((Rows == 1 && Depth != 1 && OA == ColMajor) || (Depth == 1 && Rows != 1 && OA == RowMajor) || (Cols == 1 && Depth != 1 && OB == RowMajor) || (Depth == 1 && Cols != 1 && OB == ColMajor) || (Rows == 1 && Cols != 1 && OC == ColMajor) || (Cols == 1 && Rows != 1 && OC == RowMajor)), void> test_lazy_single ( int  rows,
int  cols,
int  depth 
)
42  {
44  A.setRandom();
46  B.setRandom();
48  C.setRandom();
50  VERIFY_IS_APPROX(C += A.lazyProduct(B), ref_prod(D, A, B));
51 }

References cols, D, ref_prod(), rows, Eigen::PlainObjectBase< Derived >::setRandom(), and VERIFY_IS_APPROX.

◆ test_lazy_single() [2/2]

template<typename T , int Rows, int Cols, int Depth, int OC, int OA, int OB>
std::enable_if_t<((Rows == 1 && Depth != 1 && OA == ColMajor) || (Depth == 1 && Rows != 1 && OA == RowMajor) || (Cols == 1 && Depth != 1 && OB == RowMajor) || (Depth == 1 && Cols != 1 && OB == ColMajor) || (Rows == 1 && Cols != 1 && OC == ColMajor) || (Cols == 1 && Rows != 1 && OC == RowMajor)), void> test_lazy_single ( int  ,
int  ,
int   
)
82 {}

◆ test_linear_but_not_vectorizable()

template<typename T , int N, int M, int K>
void test_linear_but_not_vectorizable ( )
192  {
193  // Check tricky cases for which the result of the product is a vector and thus must exhibit the LinearBit flag,
194  // but is not vectorizable along the linear dimension.
195  Index n = N == Dynamic ? internal::random<Index>(1, 32) : N;
196  Index m = M == Dynamic ? internal::random<Index>(1, 32) : M;
197  Index k = K == Dynamic ? internal::random<Index>(1, 32) : K;
198 
199  {
201  A.setRandom(n, m + 1);
203  B.setRandom(m * 2, k);
206 
207  C.noalias() = A.template topLeftCorner<1, M>() * (B.template topRows<M>() + B.template bottomRows<M>());
208  R.noalias() = A.template topLeftCorner<1, M>() * (B.template topRows<M>() + B.template bottomRows<M>()).eval();
209  VERIFY_IS_APPROX(C, R);
210  }
211 
212  {
214  A.setRandom(m + 1, n);
216  B.setRandom(k, m * 2);
219 
220  C.noalias() = (B.template leftCols<M>() + B.template rightCols<M>()) * A.template topLeftCorner<M, 1>();
221  R.noalias() = (B.template leftCols<M>() + B.template rightCols<M>()).eval() * A.template topLeftCorner<M, 1>();
222  VERIFY_IS_APPROX(C, R);
223  }
224 }
@ R
Definition: StatisticsVector.h:21
@ N
Definition: constructor.cpp:22
const int Dynamic
Definition: Constants.h:25
double K
Wave number.
Definition: sphere_scattering.cc:115
internal::nested_eval< T, 1 >::type eval(const T &xpr)
Definition: sparse_permutations.cpp:47

References Eigen::Dynamic, eval(), k, PlanarWave::K, m, n, N, R, Eigen::PlainObjectBase< Derived >::setRandom(), and VERIFY_IS_APPROX.