mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-21 17:19:36 +08:00
fix triangular view assignment
This commit is contained in:
parent
b6521b799f
commit
43f0c0cbb3
@ -254,7 +254,7 @@ void TriangularView<MatrixType,Mode>::solveInPlace(const MatrixBase<OtherDerived
|
|||||||
OtherCopy otherCopy(other);
|
OtherCopy otherCopy(other);
|
||||||
|
|
||||||
ei_triangular_solver_selector<MatrixType, typename ei_unref<OtherCopy>::type,
|
ei_triangular_solver_selector<MatrixType, typename ei_unref<OtherCopy>::type,
|
||||||
Side, Mode>::run(_expression(), otherCopy);
|
Side, Mode>::run(nestedExpression(), otherCopy);
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
other = otherCopy;
|
other = otherCopy;
|
||||||
|
@ -204,8 +204,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|||||||
return m_matrix.const_cast_derived().coeffRef(row, col);
|
return m_matrix.const_cast_derived().coeffRef(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \internal */
|
const MatrixType& nestedExpression() const { return m_matrix; }
|
||||||
const MatrixType& _expression() const { return m_matrix; }
|
MatrixType& nestedExpression() { return const_cast<MatrixType&>(m_matrix); }
|
||||||
|
|
||||||
/** Assigns a triangular matrix to a triangular part of a dense matrix */
|
/** Assigns a triangular matrix to a triangular part of a dense matrix */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
@ -215,7 +215,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|||||||
TriangularView& operator=(const MatrixBase<OtherDerived>& other);
|
TriangularView& operator=(const MatrixBase<OtherDerived>& other);
|
||||||
|
|
||||||
TriangularView& operator=(const TriangularView& other)
|
TriangularView& operator=(const TriangularView& other)
|
||||||
{ return *this = other._expression(); }
|
{ return *this = other.nestedExpression(); }
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void lazyAssign(const TriangularBase<OtherDerived>& other);
|
void lazyAssign(const TriangularBase<OtherDerived>& other);
|
||||||
@ -510,15 +510,15 @@ template<typename OtherDerived>
|
|||||||
inline TriangularView<MatrixType, Mode>&
|
inline TriangularView<MatrixType, Mode>&
|
||||||
TriangularView<MatrixType, Mode>::operator=(const TriangularBase<OtherDerived>& other)
|
TriangularView<MatrixType, Mode>::operator=(const TriangularBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
ei_assert(Mode == OtherDerived::Mode);
|
ei_assert(Mode == int(OtherDerived::Mode));
|
||||||
if(ei_traits<OtherDerived>::Flags & EvalBeforeAssigningBit)
|
if(ei_traits<OtherDerived>::Flags & EvalBeforeAssigningBit)
|
||||||
{
|
{
|
||||||
typename OtherDerived::DenseMatrixType other_evaluated(other.rows(), other.cols());
|
typename OtherDerived::DenseMatrixType other_evaluated(other.rows(), other.cols());
|
||||||
other_evaluated.template triangularView<Mode>().lazyAssign(other.derived());
|
other_evaluated.template triangularView<Mode>().lazyAssign(other.derived().nestedExpression());
|
||||||
lazyAssign(other_evaluated);
|
lazyAssign(other_evaluated);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lazyAssign(other.derived());
|
lazyAssign(other.derived().nestedExpression());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ void TriangularView<MatrixType, Mode>::lazyAssign(const TriangularBase<OtherDeri
|
|||||||
<MatrixType, OtherDerived, int(Mode),
|
<MatrixType, OtherDerived, int(Mode),
|
||||||
unroll ? int(MatrixType::SizeAtCompileTime) : Dynamic,
|
unroll ? int(MatrixType::SizeAtCompileTime) : Dynamic,
|
||||||
false // preserve the opposite triangular part
|
false // preserve the opposite triangular part
|
||||||
>::run(m_matrix.const_cast_derived(), other.derived()._expression());
|
>::run(m_matrix.const_cast_derived(), other.derived().nestedExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -571,7 +571,7 @@ void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
|
|||||||
<DenseDerived, typename ei_traits<Derived>::ExpressionType, Derived::Mode,
|
<DenseDerived, typename ei_traits<Derived>::ExpressionType, Derived::Mode,
|
||||||
unroll ? int(DenseDerived::SizeAtCompileTime) : Dynamic,
|
unroll ? int(DenseDerived::SizeAtCompileTime) : Dynamic,
|
||||||
true // clear the opposite triangular part
|
true // clear the opposite triangular part
|
||||||
>::run(other.derived(), derived()._expression());
|
>::run(other.derived(), derived().nestedExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user