20 RealScalar largerEps = 10*test_precision<RealScalar>();
26 m2 = MatrixType::Random(rows, cols),
31 VectorType
v2 = VectorType::Random(rows);
33 MatrixType m1up = m1.template triangularView<Upper>();
38 VERIFY(m1up.isUpperTriangular());
39 VERIFY(m2up.transpose().isLowerTriangular());
48 r1.template triangularView<Upper>() += m1;
54 m1.template triangularView<Upper>() =
m2.transpose() +
m2;
55 m3 =
m2.transpose() +
m2;
66 m1 = MatrixType::Random(rows, cols);
72 m3 = m1.template triangularView<Upper>();
75 VERIFY(v2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(v2)), largerEps));
76 m3 = m1.template triangularView<Upper>();
77 VERIFY(v2.isApprox(m3 * (m1.template triangularView<Upper>().solve(v2)), largerEps));
82 m3 = m1.template triangularView<Upper>();
85 VERIFY(
m2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(
m2)), largerEps));
86 m3 = m1.template triangularView<Upper>();
87 VERIFY(
m2.isApprox(m3 * (m1.template triangularView<Upper>().solve(
m2)), largerEps));
93 m1.transpose().template triangularView<Eigen::Upper>().solveInPlace(trm4);
97 m3 = m1.template triangularView<Upper>();
99 m3.transpose().template triangularView<Eigen::Lower>().solveInPlace(trm4);
103 m3 = m1.template triangularView<UnitUpper>();
104 VERIFY(
m2.isApprox(m3 * (m1.template triangularView<UnitUpper>().solve(
m2)), largerEps));
112 m2.template triangularView<Upper>().
swap(m1);
114 m3.template triangularView<Upper>().
setOnes();
118 m3 = m1.template triangularView<Upper>();
124 m1up = m1.template triangularView<Upper>();
125 VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);
126 VERIFY_IS_APPROX(m1up.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);
130 VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().diagonal(), m1.diagonal());
139 enum { Rows = MatrixType::RowsAtCompileTime,
Cols = MatrixType::ColsAtCompileTime };
145 m2 = MatrixType::Random(rows, cols),
151 MatrixType m1up = m1.template triangularView<Upper>();
154 if (rows>1 && cols>1)
156 VERIFY(m1up.isUpperTriangular());
157 VERIFY(m2up.transpose().isLowerTriangular());
164 r1.template triangularView<Upper>() += m1;
170 m1.template triangularView<Upper>() = 3 *
m2;
180 m1.template triangularView<StrictlyUpper>() = 3 *
m2;
185 m1.template triangularView<StrictlyLower>() = 3 *
m2;
188 m2 = m1.template triangularView<Upper>();
191 m2 = m1.template triangularView<StrictlyUpper>();
192 VERIFY(m2.isUpperTriangular());
194 m2 = m1.template triangularView<UnitUpper>();
195 VERIFY(m2.isUpperTriangular());
196 m2.diagonal().array() -=
Scalar(1);
199 VERIFY(m2.isLowerTriangular());
200 VERIFY(!m2.isUpperTriangular());
201 m2 = m1.template triangularView<StrictlyLower>();
202 VERIFY(m2.isLowerTriangular());
204 m2 = m1.template triangularView<UnitLower>();
205 VERIFY(m2.isLowerTriangular());
206 m2.diagonal().array() -=
Scalar(1);
211 m2.template triangularView<Upper>().
swap(m1);
213 m3.template triangularView<Upper>().
setOnes();
219 Matrix3d
m = Matrix3d::Random().triangularView<
Lower>();
Expression of the transpose of a matrix.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define VERIFY_IS_APPROX(a, b)
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void triangular_square(const MatrixType &m)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
#define TEST_SET_BUT_UNUSED_VARIABLE(X)
#define EIGEN_TEST_MAX_SIZE
A triangularView< Lower >().adjoint().solveInPlace(B)
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)