mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Fix sign of SuperLU::determinant
This commit is contained in:
parent
35d3053d55
commit
bd76d837e6
@ -302,6 +302,7 @@ class SuperLUBase : public SparseSolverBase<Derived>
|
|||||||
typedef Matrix<Scalar,Dynamic,1> Vector;
|
typedef Matrix<Scalar,Dynamic,1> Vector;
|
||||||
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
|
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
|
||||||
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
|
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
|
||||||
|
typedef Map<PermutationMatrix<Dynamic,Dynamic,int> > PermutationMap;
|
||||||
typedef SparseMatrix<Scalar> LUMatrixType;
|
typedef SparseMatrix<Scalar> LUMatrixType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -460,6 +461,7 @@ class SuperLU : public SuperLUBase<_MatrixType,SuperLU<_MatrixType> >
|
|||||||
typedef typename Base::StorageIndex StorageIndex;
|
typedef typename Base::StorageIndex StorageIndex;
|
||||||
typedef typename Base::IntRowVectorType IntRowVectorType;
|
typedef typename Base::IntRowVectorType IntRowVectorType;
|
||||||
typedef typename Base::IntColVectorType IntColVectorType;
|
typedef typename Base::IntColVectorType IntColVectorType;
|
||||||
|
typedef typename Base::PermutationMap PermutationMap;
|
||||||
typedef typename Base::LUMatrixType LUMatrixType;
|
typedef typename Base::LUMatrixType LUMatrixType;
|
||||||
typedef TriangularView<LUMatrixType, Lower|UnitDiag> LMatrixType;
|
typedef TriangularView<LUMatrixType, Lower|UnitDiag> LMatrixType;
|
||||||
typedef TriangularView<LUMatrixType, Upper> UMatrixType;
|
typedef TriangularView<LUMatrixType, Upper> UMatrixType;
|
||||||
@ -774,6 +776,8 @@ typename SuperLU<MatrixType>::Scalar SuperLU<MatrixType>::determinant() const
|
|||||||
det *= m_u.valuePtr()[lastId];
|
det *= m_u.valuePtr()[lastId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(PermutationMap(m_p.data(),m_p.size()).determinant()*PermutationMap(m_q.data(),m_q.size()).determinant()<0)
|
||||||
|
det = -det;
|
||||||
if(m_sluEqued!='N')
|
if(m_sluEqued!='N')
|
||||||
return det/m_sluRscale.prod()/m_sluCscale.prod();
|
return det/m_sluRscale.prod()/m_sluCscale.prod();
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user