mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Optimize CG to enable faster spare row-major * dense vector products when the input matrix is complete (Upper|Lower) but column major.
This commit is contained in:
parent
c5f9eafcbc
commit
7f824dd613
@ -185,10 +185,13 @@ public:
|
|||||||
template<typename Rhs,typename Dest>
|
template<typename Rhs,typename Dest>
|
||||||
void _solve_with_guess_impl(const Rhs& b, Dest& x) const
|
void _solve_with_guess_impl(const Rhs& b, Dest& x) const
|
||||||
{
|
{
|
||||||
|
typedef Ref<const MatrixType> MatRef;
|
||||||
|
typedef typename internal::conditional<UpLo==(Lower|Upper) && (!MatrixType::IsRowMajor) && (!NumTraits<Scalar>::IsComplex),
|
||||||
|
Transpose<const MatRef>, MatRef const&>::type RowMajorWrapper;
|
||||||
typedef typename internal::conditional<UpLo==(Lower|Upper),
|
typedef typename internal::conditional<UpLo==(Lower|Upper),
|
||||||
Ref<const MatrixType>&,
|
RowMajorWrapper,
|
||||||
typename Ref<const MatrixType>::template ConstSelfAdjointViewReturnType<UpLo>::Type
|
typename MatRef::template ConstSelfAdjointViewReturnType<UpLo>::Type
|
||||||
>::type MatrixWrapperType;
|
>::type SelfAdjointWrapper;
|
||||||
m_iterations = Base::maxIterations();
|
m_iterations = Base::maxIterations();
|
||||||
m_error = Base::m_tolerance;
|
m_error = Base::m_tolerance;
|
||||||
|
|
||||||
@ -198,7 +201,8 @@ public:
|
|||||||
m_error = Base::m_tolerance;
|
m_error = Base::m_tolerance;
|
||||||
|
|
||||||
typename Dest::ColXpr xj(x,j);
|
typename Dest::ColXpr xj(x,j);
|
||||||
internal::conjugate_gradient(MatrixWrapperType(mp_matrix), b.col(j), xj, Base::m_preconditioner, m_iterations, m_error);
|
RowMajorWrapper row_mat(mp_matrix);
|
||||||
|
internal::conjugate_gradient(SelfAdjointWrapper(row_mat), b.col(j), xj, Base::m_preconditioner, m_iterations, m_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user