11 #define TEST_ENABLE_TEMPORARY_TRACKING 12 #define EIGEN_NO_STATIC_ASSERT 24 Index r = internal::random<Index>(0, rows-1),
25 c = internal::random<Index>(0, cols-1);
27 ArrayType
m1 = ArrayType::Random(rows, cols),
31 ColVectorType colvec = ColVectorType::Random(rows);
32 RowVectorType rowvec = RowVectorType::Random(cols);
37 m2.colwise() += colvec;
45 m2.rowwise() += rowvec;
55 m2.colwise() -= colvec;
63 m2.rowwise() -= rowvec;
73 m2.colwise() *= colvec;
81 m2.rowwise() *= rowvec;
91 m2.colwise() /= colvec;
99 m2.rowwise() /= rowvec;
110 if(ArrayType::RowsAtCompileTime>2 || ArrayType::RowsAtCompileTime==
Dynamic)
112 m2.rowwise() /= m2.colwise().sum();
118 mb = (m1.real()<=0.7).colwise().all();
119 VERIFY( (mb.col(
c) == (m1.real().col(
c)<=0.7).all()).all() );
120 mb = (m1.real()<=0.7).rowwise().all();
121 VERIFY( (mb.row(r) == (m1.real().row(r)<=0.7).all()).all() );
123 mb = (m1.real()>=0.7).colwise().any();
124 VERIFY( (mb.col(
c) == (m1.real().col(
c)>=0.7).any()).all() );
125 mb = (m1.real()>=0.7).rowwise().any();
126 VERIFY( (mb.row(r) == (m1.real().row(r)>=0.7).any()).all() );
140 Index r = internal::random<Index>(0, rows-1),
141 c = internal::random<Index>(0, cols-1);
147 ColVectorType colvec = ColVectorType::Random(rows);
148 RowVectorType rowvec = RowVectorType::Random(cols);
149 RealColVectorType rcres;
150 RealRowVectorType rrres;
155 m2.colwise() += colvec;
166 m2.rowwise() += rowvec;
179 m2.colwise() -= colvec;
190 m2.rowwise() -= rowvec;
201 rrres = m1.colwise().norm();
203 rcres = m1.rowwise().norm();
206 VERIFY_IS_APPROX(m1.cwiseAbs().colwise().sum(), m1.colwise().template lpNorm<1>());
207 VERIFY_IS_APPROX(m1.cwiseAbs().rowwise().sum(), m1.rowwise().template lpNorm<1>());
208 VERIFY_IS_APPROX(m1.cwiseAbs().colwise().maxCoeff(), m1.colwise().template lpNorm<Infinity>());
209 VERIFY_IS_APPROX(m1.cwiseAbs().rowwise().maxCoeff(), m1.rowwise().template lpNorm<Infinity>());
212 VERIFY_IS_APPROX(m1.cwiseAbs().colwise().sum().x(), m1.col(0).cwiseAbs().sum());
215 m2 = m1.colwise().normalized();
217 m2 = m1.rowwise().normalized();
222 m2.colwise().normalize();
225 m2.rowwise().normalize();
230 VERIFY_IS_APPROX( (m1 * m1.transpose()).colwise().sum(), m1m1.colwise().sum());
234 m2 = m1.rowwise() - (m1.colwise().sum()/
RealScalar(m1.rows())).eval();
235 m1 = m1.rowwise() - (m1.colwise().sum()/
RealScalar(m1.rows()));
#define VERIFY_RAISES_ASSERT(a)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
void vectorwiseop_matrix(const MatrixType &m)
#define VERIFY_EVALUATION_COUNT(XPR, N)
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
NumTraits< Scalar >::Real RealScalar
#define EIGEN_TEST_MAX_SIZE
General-purpose arrays with easy API for coefficient-wise operations.
void vectorwiseop_array(const ArrayType &m)
The matrix class, also used for vectors and row-vectors.