10 #ifdef EIGEN_TEST_PART_100 11 # define EIGEN_NO_DEPRECATED_WARNING 22 m1.setRandom(rows,cols);
23 m2.setRandom(rows,cols);
26 m1.template triangularView<Eigen::Upper>().
swap(m2);
28 m3.template triangularView<Eigen::Upper>().
swap(m4.template triangularView<Eigen::Upper>());
32 m1.template triangularView<Eigen::Lower>().
swap(m4);
34 m3.template triangularView<Eigen::Lower>().
swap(m2.template triangularView<Eigen::Lower>());
46 RealScalar largerEps = 10*test_precision<RealScalar>();
52 m2 = MatrixType::Random(rows, cols),
57 VectorType
v2 = VectorType::Random(rows);
59 MatrixType m1up = m1.template triangularView<Upper>();
64 VERIFY(m1up.isUpperTriangular());
65 VERIFY(m2up.transpose().isLowerTriangular());
74 r1.template triangularView<Upper>() += m1;
80 m1.template triangularView<Upper>() =
m2.transpose() +
m2;
81 m3 =
m2.transpose() +
m2;
92 m1 = MatrixType::Random(rows, cols);
98 m3 = m1.template triangularView<Upper>();
101 VERIFY(v2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(v2)), largerEps));
102 m3 = m1.template triangularView<Upper>();
103 VERIFY(v2.isApprox(m3 * (m1.template triangularView<Upper>().solve(v2)), largerEps));
108 m3 = m1.template triangularView<Upper>();
111 VERIFY(
m2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(
m2)), largerEps));
112 m3 = m1.template triangularView<Upper>();
113 VERIFY(
m2.isApprox(m3 * (m1.template triangularView<Upper>().solve(
m2)), largerEps));
119 m1.transpose().template triangularView<Eigen::Upper>().solveInPlace(trm4);
123 m3 = m1.template triangularView<Upper>();
125 m3.transpose().template triangularView<Eigen::Lower>().solveInPlace(trm4);
129 m3 = m1.template triangularView<UnitUpper>();
130 VERIFY(
m2.isApprox(m3 * (m1.template triangularView<UnitUpper>().solve(
m2)), largerEps));
138 m2.template triangularView<Upper>().
swap(m1.template triangularView<Eigen::Upper>());
140 m3.template triangularView<Upper>().
setOnes();
145 m3 = m1.template triangularView<Upper>();
151 m1up = m1.template triangularView<Upper>();
152 VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);
153 VERIFY_IS_APPROX(m1up.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);
157 VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().diagonal(), m1.diagonal());
168 VERIFY(
is_same_type(m3c.template selfadjointView<Lower>(),m3.template selfadjointView<Lower>().template conjugateIf<false>()) );
169 VERIFY(
is_same_type(m3c.template selfadjointView<Lower>().conjugate(),m3.template selfadjointView<Lower>().
template conjugateIf<true>()) );
170 VERIFY_IS_APPROX(m3.template selfadjointView<Lower>().template conjugateIf<true>().toDenseMatrix(),
171 m3.conjugate().template selfadjointView<Lower>().toDenseMatrix());
172 VERIFY_IS_APPROX(m3.template selfadjointView<Lower>().template conjugateIf<false>().toDenseMatrix(),
173 m3.template selfadjointView<Lower>().toDenseMatrix());
182 enum { Rows = MatrixType::RowsAtCompileTime,
Cols = MatrixType::ColsAtCompileTime };
188 m2 = MatrixType::Random(rows, cols),
194 MatrixType m1up = m1.template triangularView<Upper>();
197 if (rows>1 && cols>1)
199 VERIFY(m1up.isUpperTriangular());
200 VERIFY(m2up.transpose().isLowerTriangular());
207 r1.template triangularView<Upper>() += m1;
213 m1.template triangularView<Upper>() = 3 *
m2;
223 m1.template triangularView<StrictlyUpper>() = 3 *
m2;
228 m1.template triangularView<StrictlyLower>() = 3 *
m2;
231 m2 = m1.template triangularView<Upper>();
234 m2 = m1.template triangularView<StrictlyUpper>();
235 VERIFY(m2.isUpperTriangular());
237 m2 = m1.template triangularView<UnitUpper>();
238 VERIFY(m2.isUpperTriangular());
239 m2.diagonal().array() -=
Scalar(1);
242 VERIFY(m2.isLowerTriangular());
243 VERIFY(!m2.isUpperTriangular());
244 m2 = m1.template triangularView<StrictlyLower>();
245 VERIFY(m2.isLowerTriangular());
247 m2 = m1.template triangularView<UnitLower>();
248 VERIFY(m2.isLowerTriangular());
249 m2.diagonal().array() -=
Scalar(1);
254 m2.template triangularView<Upper>().
swap(m1.template triangularView<Eigen::Upper>());
256 m3.template triangularView<Upper>().
setOnes();
262 Matrix3d
m = Matrix3d::Random().triangularView<
Lower>();
#define CALL_SUBTEST_9(FUNC)
#define CALL_SUBTEST_6(FUNC)
#define CALL_SUBTEST_4(FUNC)
#define CALL_SUBTEST_3(FUNC)
Expression of the transpose of a matrix.
#define CALL_SUBTEST_7(FUNC)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define VERIFY_RAISES_STATIC_ASSERT(a)
#define CALL_SUBTEST_100(FUNC)
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
#define CALL_SUBTEST_1(FUNC)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define CALL_SUBTEST_8(FUNC)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void triangular_square(const MatrixType &m)
NumTraits< Scalar >::Real RealScalar
EIGEN_DECLARE_TEST(triangular)
#define TEST_SET_BUT_UNUSED_VARIABLE(X)
internal::enable_if< internal::is_same< T1, T2 >::value, bool >::type is_same_type(const T1 &, const T2 &)
#define CALL_SUBTEST_5(FUNC)
void triangular_deprecated(const MatrixType &m)
#define EIGEN_TEST_MAX_SIZE
A triangularView< Lower >().adjoint().solveInPlace(B)
#define CALL_SUBTEST_2(FUNC)
The matrix class, also used for vectors and row-vectors.
void triangular_rect(const MatrixType &m)
Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setRandom(Index size)
#define EIGEN_UNUSED_VARIABLE(var)