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());
106 VERIFY_IS_APPROX(m3.noalias() = map1 * map2.adjoint(), m1.reverse() * m2.reverse().adjoint());
109 VERIFY_IS_APPROX(map1.adjoint() * v1.transpose(), m1.adjoint().reverse() * v1.transpose());
110 VERIFY_IS_APPROX(m1.adjoint() * mapv1.transpose(), m1.adjoint() * v1.reverse().transpose());
131 Eigen::Matrix2Xd dNdxy(2, 3);
132 dNdxy << -0.5, 0.5, 0,
134 double det = 6.0, wt = 0.5;
135 VERIFY_IS_APPROX(dNdxy.transpose()*dNdxy*det*wt, det*wt*dNdxy.transpose()*dNdxy);
138 template <
typename MatrixType>
143 const int PacketSize1 = PacketSize>1 ? PacketSize-1 : 1;
152 VERIFY_IS_APPROX( (res=b.transpose()*
a.transpose()), MatrixType::Zero(cols,rows) );
158 VERIFY(res.rows()==rows && res.cols()==0);
177 VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );
193 VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );
224 ArrayXXf
B = ArrayXXf::Random(10,10),
C;
225 VectorXf
x = VectorXf::Random(10);
226 C = (x.transpose()*B.matrix());
227 B = (x.transpose()*B.matrix());
239 for(
int m=450;
m<460;++
m)
241 for(
int n=8;
n<12;++
n)
244 VectorXf
v1(
n),
r1(500);
245 RowVectorXf
v2(
m),
r2(16);
250 for(
int o=0; o<4; ++o)
252 r1.segment(o,
m).noalias() = M *
v1;
254 r2.segment(o,
n).noalias() =
v2 *
M;
266 internal::computeProductBlockingSizes<T,T>(kc, mc,
nc);
274 ret += test_compute_block_size<T>(0,1,1);
275 ret += test_compute_block_size<T>(1,0,1);
276 ret += test_compute_block_size<T>(1,1,0);
277 ret += test_compute_block_size<T>(0,0,1);
278 ret += test_compute_block_size<T>(0,1,0);
279 ret += test_compute_block_size<T>(1,0,0);
280 ret += test_compute_block_size<T>(0,0,0);
287 Index m = internal::random<Index>(10,50);
288 Index n = internal::random<Index>(10,50);
289 MatrixXd
A,
B,
C(m,n),
D(m,m);
294 double s = internal::random<double>(1,10);
297 B = A * A.transpose();
298 A = A * A.transpose();
302 B = (A * A.transpose())/s;
303 A = (A * A.transpose())/s;
307 B = (A * A.transpose()) + D;
308 A = (A * A.transpose()) + D;
312 B = D + (A * A.transpose());
313 A = D + (A * A.transpose());
317 B = s * (A * A.transpose());
318 A = s * (A * A.transpose());
333 VectorXd
v = VectorXd::Random(n);
334 r = v * RowVectorXd::Ones(n);
336 r = VectorXd::Ones(n) * v.transpose();
339 Matrix4d ones44 = Matrix4d::Ones();
340 Matrix4d m44 = Matrix4d::Ones() * Matrix4d::Ones();
342 VERIFY_IS_APPROX(m44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));
343 VERIFY_IS_APPROX(m44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));
344 VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));
345 VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
348 RMatrix4d r44 = Matrix4d::Ones() * Matrix4d::Ones();
350 VERIFY_IS_APPROX(r44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));
351 VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));
352 VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));
353 VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
354 VERIFY_IS_APPROX(r44.noalias()=ones44*RMatrix4d::Ones(), Matrix4d::Constant(4));
355 VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*RMatrix4d::Ones(), Matrix4d::Constant(4));
356 VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44, Matrix4d::Constant(4));
357 VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));
362 VERIFY_IS_APPROX(r44.noalias() += m44.row(0).transpose() * RowVector4d::Ones(), ones44);
364 VERIFY_IS_APPROX(r44.noalias() += m44.col(0) * RowVector4d::Ones(), ones44);
368 VERIFY_IS_APPROX(r44.noalias() += Vector4d::Ones() * m44.col(0).transpose(), ones44);
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
#define CALL_SUBTEST_6(FUNC)
#define CALL_SUBTEST_4(FUNC)
Matrix< RealScalar, Dynamic, Dynamic > M
void adjoint(const MatrixType &m)
A matrix or vector expression mapping an existing array of data.
#define CALL_SUBTEST_3(FUNC)
#define CALL_SUBTEST_7(FUNC)
Holds strides information for Map.
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
const unsigned int RowMajorBit
AnnoyingScalar conj(const AnnoyingScalar &x)
#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 const SquareReturnType square() const
#define CALL_SUBTEST_1(FUNC)
Convenience specialization of Stride to specify only an inner stride See class Map for some examples...
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Array< int, Dynamic, 1 > v
#define CALL_SUBTEST_8(FUNC)
EIGEN_DEVICE_FUNC ConjugateReturnType conjugate() const
Matrix< Scalar, Dynamic, Dynamic > C
#define CALL_SUBTEST_5(FUNC)
#define EIGEN_TEST_MAX_SIZE
General-purpose arrays with easy API for coefficient-wise operations.
#define CALL_SUBTEST_2(FUNC)
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)