14 template<
typename MatrixType>
16 return m.cwiseAbs().colwise().sum().maxCoeff();
26 if(MatrixType::RowsAtCompileTime==
Dynamic)
32 rows = MatrixType::RowsAtCompileTime;
34 if(MatrixType::ColsAtCompileTime==
Dynamic)
41 cols2 = cols = MatrixType::ColsAtCompileTime;
45 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
46 ColsAtCompileTime = MatrixType::ColsAtCompileTime
48 typedef typename internal::kernel_retval_base<FullPivLU<MatrixType> >::ReturnType KernelMatrixType;
49 typedef typename internal::image_retval_base<FullPivLU<MatrixType> >::ReturnType ImageMatrixType;
55 Index rank = internal::random<Index>(1, (
std::min)(rows, cols)-1);
58 VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).
cols() == 1));
61 KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel();
62 VERIFY((kernel.fullPivLu().isInvertible()));
65 CMatrixType
m2(cols, cols2);
77 u = lu.
matrixLU().template triangularView<Upper>();
78 RMatrixType
l = RMatrixType::Identity(rows,rows);
79 l.block(0,0,rows,(
std::min)(rows,cols)).template triangularView<StrictlyLower>()
84 KernelMatrixType m1kernel = lu.
kernel();
85 ImageMatrixType m1image = lu.
image(
m1);
94 VERIFY(m1image.fullPivLu().rank() == rank);
97 m2 = CMatrixType::Random(cols,cols2);
99 m2 = CMatrixType::Random(cols,cols2);
101 m2.block(0,0,m2.rows(),m2.cols()) = lu.
solve(m3);
105 m3 = MatrixType::Random(rows,cols2);
106 m2 =
m1.transpose()*m3;
107 m3 = MatrixType::Random(rows,cols2);
108 lu.template _solve_impl_transposed<false>(
m2, m3);
110 m3 = MatrixType::Random(rows,cols2);
115 m3 = MatrixType::Random(rows,cols2);
116 m2 =
m1.adjoint()*m3;
117 m3 = MatrixType::Random(rows,cols2);
118 lu.template _solve_impl_transposed<true>(
m2, m3);
120 m3 = MatrixType::Random(rows,cols2);
131 Index size = MatrixType::RowsAtCompileTime;
139 m1 = MatrixType::Random(size,size);
151 m3 = MatrixType::Random(size,size);
158 const RealScalar rcond_est = lu.
rcond();
161 VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
164 lu.template _solve_impl_transposed<false>(m3,
m2);
166 m3 = MatrixType::Random(size,size);
171 lu.template _solve_impl_transposed<true>(m3,
m2);
173 m3 = MatrixType::Random(size,size);
178 MatrixType m4 = MatrixType::Random(size,size);
188 Index size = internal::random<Index>(1,4);
196 m3 = MatrixType::Random(size,size);
203 const RealScalar rcond_est = plu.
rcond();
205 VERIFY(rcond_est > rcond / 10 && rcond_est < rcond * 10);
208 plu.template _solve_impl_transposed<false>(m3,
m2);
210 m3 = MatrixType::Random(size,size);
215 plu.template _solve_impl_transposed<true>(m3,
m2);
217 m3 = MatrixType::Random(size,size);
252 CALL_SUBTEST_1( lu_non_invertible<Matrix3f>() );
253 CALL_SUBTEST_1( lu_invertible<Matrix3f>() );
254 CALL_SUBTEST_1( lu_verify_assert<Matrix3f>() );
259 CALL_SUBTEST_3( lu_non_invertible<MatrixXf>() );
260 CALL_SUBTEST_3( lu_invertible<MatrixXf>() );
261 CALL_SUBTEST_3( lu_verify_assert<MatrixXf>() );
263 CALL_SUBTEST_4( lu_non_invertible<MatrixXd>() );
264 CALL_SUBTEST_4( lu_invertible<MatrixXd>() );
265 CALL_SUBTEST_4( lu_partial_piv<MatrixXd>() );
266 CALL_SUBTEST_4( lu_verify_assert<MatrixXd>() );
268 CALL_SUBTEST_5( lu_non_invertible<MatrixXcf>() );
269 CALL_SUBTEST_5( lu_invertible<MatrixXcf>() );
270 CALL_SUBTEST_5( lu_verify_assert<MatrixXcf>() );
272 CALL_SUBTEST_6( lu_non_invertible<MatrixXcd>() );
273 CALL_SUBTEST_6( lu_invertible<MatrixXcd>() );
274 CALL_SUBTEST_6( lu_partial_piv<MatrixXcd>() );
275 CALL_SUBTEST_6( lu_verify_assert<MatrixXcd>() );
#define VERIFY_RAISES_ASSERT(a)
const Inverse< PartialPivLU > inverse() const
const internal::image_retval< FullPivLU > image(const MatrixType &originalMatrix) const
FullPivLU & setThreshold(const RealScalar &threshold)
internal::traits< MatrixType >::Scalar determinant() const
EIGEN_DEVICE_FUNC const PermutationPType & permutationP() const
FullPivLU & compute(const EigenBase< InputType > &matrix)
AdjointReturnType adjoint() const
LU decomposition of a matrix with partial pivoting, and related features.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
bool isSurjective() const
#define VERIFY_IS_APPROX(a, b)
static const Line3 l(Rot3(), 1, 1)
const PermutationQType & permutationQ() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
cout<< "Here is the matrix m:"<< endl<< m<< endl;Eigen::FullPivLU< Matrix5x3 > lu(m)
NumTraits< Scalar >::Real RealScalar
MatrixType reconstructedMatrix() const
#define VERIFY_IS_MUCH_SMALLER_THAN(a, b)
ConstTransposeReturnType transpose() const
#define EIGEN_TEST_MAX_SIZE
LU decomposition of a matrix with complete pivoting, and related features.
bool isInvertible() const
MatrixType::RealScalar matrix_l1_norm(const MatrixType &m)
void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType &m)
const MatrixType & matrixLU() const
MatrixType reconstructedMatrix() const
The matrix class, also used for vectors and row-vectors.
const Inverse< FullPivLU > inverse() const
const Solve< PartialPivLU, Rhs > solve(const MatrixBase< Rhs > &b) const
Index dimensionOfKernel() const
const Solve< FullPivLU, Rhs > solve(const MatrixBase< Rhs > &b) const
const internal::kernel_retval< FullPivLU > kernel() const