mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-13 00:21:49 +08:00
bug #1617: Fix SolveTriangular.solveInPlace crashing for empty matrix.
This made FullPivLU.kernel() crash when used on the zero matrix. Add unit test for FullPivLU.kernel() on the zero matrix. (grafted from 8d7a73e48e82b41f8e8b90afb434c98452556990 )
This commit is contained in:
parent
d107a371c6
commit
0ee9dede55
@ -169,6 +169,9 @@ void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<Ot
|
|||||||
OtherDerived& other = _other.const_cast_derived();
|
OtherDerived& other = _other.const_cast_derived();
|
||||||
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
|
eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );
|
||||||
eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
|
eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));
|
||||||
|
// If solving for a 0x0 matrix, nothing to do, simply return.
|
||||||
|
if (derived().cols() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
enum { copy = (internal::traits<OtherDerived>::Flags & RowMajorBit) && OtherDerived::IsVectorAtCompileTime && OtherDerived::SizeAtCompileTime!=1};
|
enum { copy = (internal::traits<OtherDerived>::Flags & RowMajorBit) && OtherDerived::IsVectorAtCompileTime && OtherDerived::SizeAtCompileTime!=1};
|
||||||
typedef typename internal::conditional<copy,
|
typedef typename internal::conditional<copy,
|
||||||
|
@ -57,6 +57,10 @@ template<typename MatrixType> void lu_non_invertible()
|
|||||||
// The image of the zero matrix should consist of a single (zero) column vector
|
// The image of the zero matrix should consist of a single (zero) column vector
|
||||||
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
||||||
|
|
||||||
|
// The kernel of the zero matrix is the entire space, and thus is an invertible matrix of dimensions cols.
|
||||||
|
KernelMatrixType kernel = MatrixType::Zero(rows,cols).fullPivLu().kernel();
|
||||||
|
VERIFY((kernel.fullPivLu().isInvertible()));
|
||||||
|
|
||||||
MatrixType m1(rows, cols), m3(rows, cols2);
|
MatrixType m1(rows, cols), m3(rows, cols2);
|
||||||
CMatrixType m2(cols, cols2);
|
CMatrixType m2(cols, cols2);
|
||||||
createRandomPIMatrixOfRank(rank, rows, cols, m1);
|
createRandomPIMatrixOfRank(rank, rows, cols, m1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user