10 #define EIGEN_NO_STATIC_ASSERT 23 matAstatic.cwiseProduct(matBstatic.transpose()).
sum() );
25 MatrixXf matAdynamic(1,3);
26 MatrixXf matBdynamic(3,1);
27 matAdynamic.setRandom();
28 matBdynamic.setRandom();
30 matAdynamic.cwiseProduct(matBdynamic.transpose()).
sum() );
33 template<
typename TC,
typename TA,
typename TB>
38 for(
Index k=0;k<A.cols();++k)
39 C.coeffRef(
i,
j) += A.coeff(
i,k) * B.coeff(k,
j);
43 template<
typename T,
int Rows,
int Cols,
int Depth,
int OC,
int OA,
int OB>
44 typename internal::enable_if<! ( (Rows ==1&&Depth!=1&&OA==
ColMajor)
45 || (Depth==1&&Rows !=1&&OA==
RowMajor)
59 template<
typename T,
int Rows,
int Cols,
int Depth,
int OC,
int OA,
int OB>
60 typename internal::enable_if< ( (Rows ==1&&Depth!=1&&OA==
ColMajor)
61 || (Depth==1&&Rows !=1&&OA==
RowMajor)
70 template<
typename T,
int Rows,
int Cols,
int Depth>
73 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,ColMajor,ColMajor>(rows,cols,depth) ));
74 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,ColMajor,ColMajor>(rows,cols,depth) ));
75 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,RowMajor,ColMajor>(rows,cols,depth) ));
76 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,RowMajor,ColMajor>(rows,cols,depth) ));
77 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,ColMajor,RowMajor>(rows,cols,depth) ));
78 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,ColMajor,RowMajor>(rows,cols,depth) ));
79 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,RowMajor,RowMajor>(rows,cols,depth) ));
80 CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,RowMajor,RowMajor>(rows,cols,depth) ));
86 int rows = internal::random<int>(1,12);
87 int cols = internal::random<int>(1,12);
88 int depth = internal::random<int>(1,12);
96 CALL_SUBTEST(( test_lazy_all_layout<T,1,1,-1>(1,1,depth) ));
105 CALL_SUBTEST(( test_lazy_all_layout<T,4,-1,1>(4,cols) ));
106 CALL_SUBTEST(( test_lazy_all_layout<T,7,-1,1>(7,cols) ));
109 CALL_SUBTEST(( test_lazy_all_layout<T,-1,-1,1>(rows,cols) ));
115 int rows = internal::random<int>(1,12);
116 int cols = internal::random<int>(1,12);
117 int depth = internal::random<int>(1,12);
130 CALL_SUBTEST(( test_lazy_all_layout<T,4,1,-1>(4,1,depth) ));
131 CALL_SUBTEST(( test_lazy_all_layout<T,-1,1,-1>(rows,1,depth) ));
143 CALL_SUBTEST(( test_lazy_all_layout<T,1,-1, 4>(1,cols) ));
144 CALL_SUBTEST(( test_lazy_all_layout<T,1, 4,-1>(1,4,depth) ));
145 CALL_SUBTEST(( test_lazy_all_layout<T,1,-1,-1>(1,cols,depth) ));
151 int rows = internal::random<int>(1,12);
152 int cols = internal::random<int>(1,12);
153 int depth = internal::random<int>(1,12);
165 CALL_SUBTEST(( test_lazy_all_layout<T,4,3,-1>(4,3,depth) ));
166 CALL_SUBTEST(( test_lazy_all_layout<T,-1,6,-1>(rows,6,depth) ));
176 CALL_SUBTEST(( test_lazy_all_layout<T,8,-1, 4>(8,cols) ));
177 CALL_SUBTEST(( test_lazy_all_layout<T,3, 4,-1>(3,4,depth) ));
178 CALL_SUBTEST(( test_lazy_all_layout<T,4,-1,-1>(4,cols,depth) ));
181 template<
typename T,
int N,
int M,
int K>
196 C.noalias() = A.template topLeftCorner<1,M>() * (B.template topRows<M>()+B.template bottomRows<M>());
197 R.noalias() = A.template topLeftCorner<1,M>() * (B.template topRows<M>()+B.template bottomRows<M>()).eval();
207 C.noalias() = (B.template leftCols<M>()+B.template rightCols<M>()) * A.template topLeftCorner<M,1>();
208 R.noalias() = (B.template leftCols<M>()+B.template rightCols<M>()).
eval() * A.template topLeftCorner<M,1>();
217 Vector2d
b = Vector2d::Random() ;
219 res.noalias() = 1. * (A *
b);
221 res.noalias() = 1.*A *
b;
223 res.noalias() = (1.*
A).lazyProduct(b);
225 res.noalias() = (1.*
A).lazyProduct(1.*b);
227 res.noalias() = (
A).lazyProduct(1.*b);
237 CALL_SUBTEST_3(
product(Matrix3d()) );
238 CALL_SUBTEST_4(
product(Matrix4d()) );
239 CALL_SUBTEST_5(
product(Matrix4f()) );
240 CALL_SUBTEST_6( product1x1<0>() );
242 CALL_SUBTEST_11( test_lazy_l1<float>() );
243 CALL_SUBTEST_12( test_lazy_l2<float>() );
244 CALL_SUBTEST_13( test_lazy_l3<float>() );
246 CALL_SUBTEST_21( test_lazy_l1<double>() );
247 CALL_SUBTEST_22( test_lazy_l2<double>() );
248 CALL_SUBTEST_23( test_lazy_l3<double>() );
250 CALL_SUBTEST_31(
test_lazy_l1<std::complex<float> >() );
251 CALL_SUBTEST_32(
test_lazy_l2<std::complex<float> >() );
252 CALL_SUBTEST_33(
test_lazy_l3<std::complex<float> >() );
254 CALL_SUBTEST_41(
test_lazy_l1<std::complex<double> >() );
255 CALL_SUBTEST_42(
test_lazy_l2<std::complex<double> >() );
256 CALL_SUBTEST_43(
test_lazy_l3<std::complex<double> >() );
258 CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,Dynamic>() ));
259 CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,3,1,Dynamic>() ));
260 CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,16>() ));
262 CALL_SUBTEST_6( bug_1311<3>() );
263 CALL_SUBTEST_6( bug_1311<5>() );
266 #ifdef EIGEN_TEST_PART_6 269 Vector3f
v = Vector3f::Random();
286 for(
int k=0; k<79; ++k)
288 B.noalias() = (((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A)) * ((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A)))
289 * (((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A)) * ((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A))*((A*A)*(A*
A))*((A*
A)*(A*A)));
void test_lazy_all_layout(int rows=Rows, int cols=Cols, int depth=Depth)
Matrix< RealScalar, Dynamic, Dynamic > M
Rot2 R(Rot2::fromAngle(0.1))
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
void test_linear_but_not_vectorizable()
void test_product_small()
Matrix< SCALARA, Dynamic, Dynamic > A
Matrix< SCALARB, Dynamic, Dynamic > B
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Matrix< Scalar, Dynamic, Dynamic > C
#define CALL_SUBTEST(FUNC)
internal::enable_if<!((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 >::type test_lazy_single(int rows, int cols, int depth)
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setRandom(Index size)
const TC & ref_prod(TC &C, const TA &A, const TB &B)
void product(const MatrixType &m)