6 template<
typename Lhs,
typename Rhs>
13 template<
typename Lhs,
typename Rhs>
20 template<
typename DstXprType,
typename SrcXprType>
28 template<
typename DstXprType,
template <
typename>
class StorageBase,
typename SrcXprType>
36 template<
typename DstXprType,
typename SrcXprType>
40 #ifdef EIGEN_NO_AUTOMATIC_RESIZING 41 eigen_assert((dst.size()==0 || (IsVectorAtCompileTime ? (dst.size() == src.size())
42 : (dst.
rows() == src.rows() && dst.
cols() == src.cols())))
43 &&
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
45 dst.const_cast_derived().
resizeLike(src.derived());
49 return dst.const_cast_derived();
52 template<
typename DstXprType,
typename SrcXprType>
59 template<
typename DstXprType,
typename SrcXprType>
66 template<
typename DstXprType,
typename SrcXprType>
73 template<
typename DstXprType,
typename SrcXprType>
80 template<
typename DstXprType,
typename SrcXprType>
88 template<
typename Dst,
template <
typename>
class StorageBase,
typename Src,
typename Func>
101 #define VERIFY_IS_APPROX_EVALUATOR(DEST,EXPR) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (EXPR).eval()); 102 #define VERIFY_IS_APPROX_EVALUATOR2(DEST,EXPR,REF) VERIFY_IS_APPROX(copy_using_evaluator(DEST,(EXPR)), (REF).eval()); 107 Vector2d
v = Vector2d::Random();
108 const Vector2d v_const(v);
130 const ArrayXXf a_const(a);
138 VERIFY((w.array() >= -1).all() && (w.array() <= 1).all());
150 int s = internal::random<int>(1,100);
151 MatrixXf
a(s,s),
b(s,s),
c(s,s),
d(s,s);
184 int s = internal::random<int>(1,100);
228 const ArrayXXf a_const(a);
244 MatrixXd
mat1(6,6), mat2(6,6);
250 ArrayXXd arr1(6,6), arr2(6,6);
278 Matrix4f m4, m4src = Matrix4f::Random();
279 Array44f a4, a4src = Matrix4f::Random();
288 MatrixXf mX(6,6), mXsrc = MatrixXf::Random(6,6);
289 ArrayXXf aX(6,6), aXsrc = ArrayXXf::Random(6,6);
303 m4ref.block(1, 1, 2, 3) = m3.bottomRows(2);
306 mX.setIdentity(20,20);
307 MatrixXf mXref = MatrixXf::Identity(20,20);
308 mXsrc = MatrixXf::Random(9,12);
310 mXref.block(4, 4, 9, 12) = mXsrc;
314 const float raw[3] = {1,2,3};
315 float buffer[3] = {0,0,0};
320 Vector3f::Map(buffer) = 2*
v3;
328 MatrixXcd matXcd(6,6), matXcd_ref(6,6);
331 matXcd_ref.real() =
mat1;
332 matXcd_ref.imag() = mat2;
339 mXsrc = MatrixXf::Random(6, 6);
340 VectorXf vX = VectorXf::Random(6);
343 matXcd.resize(12, 12);
359 mat2.array() = arr1 * arr1;
361 arr2.matrix() = MatrixXd::Identity(6,6);
368 arr2.reverse() = arr1;
370 mat2.array() =
mat1.array().reverse();
382 mat2.diagonal(1) =
vec1;
386 mat2.diagonal<-1>() = mat2.diagonal(1);
392 MatrixXd
mat1, mat2, mat1ref, mat2ref;
393 mat1ref = mat1 = MatrixXd::Random(6, 6);
394 mat2ref = mat2 = 2 * mat1 + MatrixXd::Identity(6, 6);
396 mat1ref.swap(mat2ref);
401 mat1ref.block(0, 0, 3, 3).swap(mat2ref.block(3, 3, 3, 3));
406 mat1.row(2).swap(mat2.col(3).transpose());
413 const Matrix4d mat_const = Matrix4d::Random();
414 Matrix4d
mat, mat_ref;
415 mat = mat_ref = Matrix4d::Identity();
417 mat_ref += mat_const;
421 mat_ref.row(1) -= 2*mat_ref.row(2);
424 const ArrayXXf arr_const = ArrayXXf::Random(5,3);
425 ArrayXXf
arr, arr_ref;
426 arr = arr_ref = ArrayXXf::Constant(5, 3, 0.5);
428 arr_ref *= arr_const;
432 arr_ref.row(1) /= (arr_ref.row(2) + 1);
438 MatrixXd
A = MatrixXd::Random(6,6),
B(6,6),
C(6,6),
D(6,6);
439 A.setRandom();
B.setRandom();
442 A.setRandom();
B.setRandom();
445 A.setRandom();
B.setRandom();
448 A.setRandom();
B.setRandom();
449 C =
B;
C.triangularView<
Upper>() = A;
451 VERIFY(
B.isApprox(
C) &&
"copy_using_evaluator(B.triangularView<Upper>(), A)");
453 A.setRandom();
B.setRandom();
454 C =
B;
C.triangularView<
Lower>() = A.triangularView<
Lower>();
456 VERIFY(
B.isApprox(
C) &&
"copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Lower>())");
459 A.setRandom();
B.setRandom();
460 C =
B;
C.triangularView<
Lower>() = A.triangularView<
Upper>().transpose();
462 VERIFY(
B.isApprox(
C) &&
"copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Lower>().transpose())");
465 A.setRandom();
B.setRandom();
C =
B;
D = A;
468 VERIFY(
B.isApprox(
C) &&
"swap_using_evaluator(B.triangularView<Upper>(), A.triangularView<Upper>())");
478 VectorXd
d = VectorXd::Random(6);
479 MatrixXd
A = MatrixXd::Random(6,6),
B(6,6);
480 A.setRandom();
B.setRandom();
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
#define EIGEN_STRONG_INLINE
m m block(1, 0, 2, 2)<< 4
Pseudo expression providing an operator = assuming no aliasing.
A matrix or vector expression mapping an existing array of data.
#define VERIFY_IS_APPROX_EVALUATOR(DEST, EXPR)
EIGEN_DEVICE_FUNC void call_assignment(const NoAlias< Dst, StorageBase > &dst, const Src &src, const Func &func)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
Namespace containing all symbols from the Eigen library.
MatrixXd mat1(size, size)
Matrix< SCALARB, Dynamic, Dynamic > B
EIGEN_STRONG_INLINE DstXprType & copy_using_evaluator(const EigenBase< DstXprType > &dst, const SrcXprType &src)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase< OtherDerived > &_other)
EIGEN_DEVICE_FUNC Derived & const_cast_derived() const
#define VERIFY_IS_APPROX(a, b)
#define VERIFY_IS_EQUAL(a, b)
#define VERIFY_IS_APPROX_EVALUATOR2(DEST, EXPR, REF)
void swap_using_evaluator(const DstXprType &dst, const SrcXprType &src)
void subtract_assign_using_evaluator(const DstXprType &dst, const SrcXprType &src)
Matrix< Scalar, Dynamic, Dynamic > C
void add_assign_using_evaluator(const DstXprType &dst, const SrcXprType &src)
void divide_assign_using_evaluator(const DstXprType &dst, const SrcXprType &src)
void multiply_assign_using_evaluator(const DstXprType &dst, const SrcXprType &src)
EIGEN_DEVICE_FUNC ExpressionType & expression() const
const Product< Lhs, Rhs, LazyProduct > lazyprod(const Lhs &lhs, const Rhs &rhs)
long get_cost(const XprType &)
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
The matrix class, also used for vectors and row-vectors.
Derived & setRandom(Index size)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment(Dst &dst, const Src &src)
void swap(scoped_array< T > &a, scoped_array< T > &b)
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)