18 MatrixType::Flags&
RowMajorBit> OtherMajorMatrixType;
24 m2 = MatrixType::Random(rows, cols),
26 mzero = MatrixType::Zero(rows, cols),
27 identity = MatrixType::Identity(rows, rows),
28 square = MatrixType::Random(rows, rows),
29 res = MatrixType::Random(rows, rows),
30 square2 = MatrixType::Random(cols, cols),
31 res2 = MatrixType::Random(cols, cols);
32 RowVectorType
v1 = RowVectorType::Random(rows), vrres(rows);
33 ColVectorType vc2 = ColVectorType::Random(cols), vcres(cols);
34 OtherMajorMatrixType tm1 =
m1;
36 Scalar s1 = internal::random<Scalar>(),
37 s2 = internal::random<Scalar>(),
38 s3 = internal::random<Scalar>();
56 (-m1.conjugate()*s2).
eval() * (s1 * vc2).
eval());
58 (-m1*s2).eval() * (s1 * vc2.conjugate()).
eval());
60 (-m1.conjugate()*s2).
eval() * (s1 * vc2.conjugate()).
eval());
63 (s1 * vc2.transpose()).
eval() * (-m1.adjoint()*s2).
eval());
65 (s1 * vc2.adjoint()).
eval() * (-m1.transpose()*s2).
eval());
67 (s1 * vc2.adjoint()).
eval() * (-m1.adjoint()*s2).
eval());
70 (-m1.adjoint()*s2).
eval() * (s1 * v1.transpose()).
eval());
72 (-m1.transpose()*s2).
eval() * (s1 * v1.adjoint()).
eval());
74 (-m1.adjoint()*s2).
eval() * (s1 * v1.adjoint()).
eval());
77 (s1 * v1).eval() * (-m1.conjugate()*s2).
eval());
79 (s1 * v1.conjugate()).
eval() * (-m1*s2).
eval());
81 (s1 * v1.conjugate()).
eval() * (-m1.conjugate()*s2).
eval());
84 (-m1.adjoint()*s2).
eval() * (s1 * v1.adjoint()).
eval());
87 Index i = internal::random<Index>(0,m1.rows()-2);
88 Index j = internal::random<Index>(0,m1.cols()-2);
89 Index r = internal::random<Index>(1,m1.rows()-
i);
90 Index c = internal::random<Index>(1,m1.cols()-
j);
91 Index i2 = internal::random<Index>(0,m1.rows()-1);
92 Index j2 = internal::random<Index>(0,m1.cols()-1);
94 VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),
c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),
c).
eval());
95 VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).
eval() * m1.row(i2).adjoint().eval());
115 Eigen::Matrix2Xd dNdxy(2, 3);
116 dNdxy << -0.5, 0.5, 0,
118 double det = 6.0, wt = 0.5;
119 VERIFY_IS_APPROX(dNdxy.transpose()*dNdxy*det*wt, det*wt*dNdxy.transpose()*dNdxy);
122 template <
typename MatrixType>
127 const int PacketSize1 = PacketSize>1 ? PacketSize-1 : 1;
136 VERIFY_IS_APPROX( (res=b.transpose()*
a.transpose()), MatrixType::Zero(cols,rows) );
142 VERIFY(res.rows()==rows && res.cols()==0);
161 VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );
177 VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );
208 ArrayXXf
B = ArrayXXf::Random(10,10),
C;
209 VectorXf
x = VectorXf::Random(10);
210 C = (x.transpose()*B.matrix());
211 B = (x.transpose()*B.matrix());
223 for(
int m=450;
m<460;++
m)
225 for(
int n=8;
n<12;++
n)
228 VectorXf
v1(
n),
r1(500);
229 RowVectorXf
v2(
m),
r2(16);
234 for(
int o=0; o<4; ++o)
236 r1.segment(o,
m).noalias() = M *
v1;
238 r2.segment(o,
n).noalias() =
v2 *
M;
250 internal::computeProductBlockingSizes<T,T>(kc, mc,
nc);
258 ret += test_compute_block_size<T>(0,1,1);
259 ret += test_compute_block_size<T>(1,0,1);
260 ret += test_compute_block_size<T>(1,1,0);
261 ret += test_compute_block_size<T>(0,0,1);
262 ret += test_compute_block_size<T>(0,1,0);
263 ret += test_compute_block_size<T>(1,0,0);
264 ret += test_compute_block_size<T>(0,0,0);
271 Index m = internal::random<Index>(10,50);
272 Index n = internal::random<Index>(10,50);
273 MatrixXd
A,
B,
C(m,n),
D(m,m);
278 double s = internal::random<double>(1,10);
281 B = A * A.transpose();
282 A = A * A.transpose();
286 B = (A * A.transpose())/s;
287 A = (A * A.transpose())/s;
291 B = (A * A.transpose()) + D;
292 A = (A * A.transpose()) + D;
296 B = D + (A * A.transpose());
297 A = D + (A * A.transpose());
301 B = s * (A * A.transpose());
302 A = s * (A * A.transpose());
317 VectorXd
v = VectorXd::Random(n);
318 r = v * RowVectorXd::Ones(n);
320 r = VectorXd::Ones(n) * v.transpose();
323 Matrix4d ones44 = Matrix4d::Ones();
324 Matrix4d m44 = Matrix4d::Ones() * Matrix4d::Ones();
326 VERIFY_IS_APPROX(m44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));
327 VERIFY_IS_APPROX(m44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));
328 VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));
329 VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
332 RMatrix4d r44 = Matrix4d::Ones() * Matrix4d::Ones();
334 VERIFY_IS_APPROX(r44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));
335 VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));
336 VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));
337 VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
338 VERIFY_IS_APPROX(r44.noalias()=ones44*RMatrix4d::Ones(), Matrix4d::Constant(4));
339 VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*RMatrix4d::Ones(), Matrix4d::Constant(4));
340 VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44, Matrix4d::Constant(4));
341 VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
346 VERIFY_IS_APPROX(r44.noalias() += m44.row(0).transpose() * RowVector4d::Ones(), ones44);
348 VERIFY_IS_APPROX(r44.noalias() += m44.col(0) * RowVector4d::Ones(), ones44);
352 VERIFY_IS_APPROX(r44.noalias() += Vector4d::Ones() * m44.col(0).transpose(), ones44);
365 CALL_SUBTEST_5( bug_127<0>() );
366 CALL_SUBTEST_5( bug_817<0>() );
367 CALL_SUBTEST_5( bug_1308<0>() );
368 CALL_SUBTEST_6( unaligned_objects<0>() );
369 CALL_SUBTEST_7( compute_block_size<float>() );
370 CALL_SUBTEST_7( compute_block_size<double>() );
372 CALL_SUBTEST_8( aliasing_with_resize<void>() );
Matrix< RealScalar, Dynamic, Dynamic > M
void adjoint(const MatrixType &m)
Matrix< SCALARA, Dynamic, Dynamic > A
Matrix< SCALARB, Dynamic, Dynamic > B
const unsigned int RowMajorBit
#define EIGEN_DONT_INLINE
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEVICE_FUNC ConjugateReturnType conjugate() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Matrix< Scalar, Dynamic, Dynamic > C
#define EIGEN_TEST_MAX_SIZE
General-purpose arrays with easy API for coefficient-wise operations.
internal::nested_eval< T, 1 >::type eval(const T &xpr)
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Derived & setRandom(Index size)
EIGEN_DEVICE_FUNC const SquareReturnType square() const
ScalarWithExceptions conj(const ScalarWithExceptions &x)