mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Optimize Simplicial Cholesky when NaturalOrdering is used.
This commit is contained in:
parent
30c849669d
commit
7f7a712062
@ -607,22 +607,35 @@ void SimplicialCholeskyBase<Derived>::ordering(const MatrixType& a, CholMatrixTy
|
|||||||
{
|
{
|
||||||
eigen_assert(a.rows()==a.cols());
|
eigen_assert(a.rows()==a.cols());
|
||||||
const Index size = a.rows();
|
const Index size = a.rows();
|
||||||
// Note that amd compute the inverse permutation
|
// Note that ordering methods compute the inverse permutation
|
||||||
|
if(!internal::is_same<OrderingType,NaturalOrdering<Index> >::value)
|
||||||
{
|
{
|
||||||
CholMatrixType C;
|
{
|
||||||
C = a.template selfadjointView<UpLo>();
|
CholMatrixType C;
|
||||||
|
C = a.template selfadjointView<UpLo>();
|
||||||
|
|
||||||
|
OrderingType ordering;
|
||||||
|
ordering(C,m_Pinv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_Pinv.size()>0) m_P = m_Pinv.inverse();
|
||||||
|
else m_P.resize(0);
|
||||||
|
|
||||||
OrderingType ordering;
|
ap.resize(size,size);
|
||||||
ordering(C,m_Pinv);
|
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Pinv.size()>0)
|
|
||||||
m_P = m_Pinv.inverse();
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_Pinv.resize(0);
|
||||||
m_P.resize(0);
|
m_P.resize(0);
|
||||||
|
if(UpLo==Lower)
|
||||||
ap.resize(size,size);
|
{
|
||||||
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
|
ap.resize(size,size);
|
||||||
|
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ap = a.template triangularView<Upper>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user