renamed inverseProduct => solveTriangular

This commit is contained in:
Gael Guennebaud
2008-08-09 20:06:25 +00:00
parent d6e88f8155
commit b13148c358
16 changed files with 90 additions and 72 deletions

View File

@@ -141,7 +141,7 @@ typename Derived::Eval Cholesky<MatrixType>::solve(const MatrixBase<Derived> &b)
const int size = m_matrix.rows();
ei_assert(size==b.rows());
return m_matrix.adjoint().template part<Upper>().inverseProduct(matrixL().inverseProduct(b));
return m_matrix.adjoint().template part<Upper>().solveTriangular(matrixL().solveTriangular(b));
}
/** \cholesky_module

View File

@@ -148,9 +148,9 @@ typename Derived::Eval CholeskyWithoutSquareRoot<MatrixType>::solve(const Matrix
ei_assert(size==b.rows());
return m_matrix.adjoint().template part<UnitUpper>()
.inverseProduct(
.solveTriangular(
(matrixL()
.inverseProduct(b))
.solveTriangular(b))
.cwise()/m_matrix.diagonal()
);
}

View File

@@ -320,10 +320,10 @@ template<typename Derived> class MatrixBase
Derived& operator*=(const MatrixBase<OtherDerived>& other);
template<typename OtherDerived>
typename OtherDerived::Eval inverseProduct(const MatrixBase<OtherDerived>& other) const;
typename OtherDerived::Eval solveTriangular(const MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived>
void inverseProductInPlace(MatrixBase<OtherDerived>& other) const;
void solveTriangularInPlace(MatrixBase<OtherDerived>& other) const;
template<typename OtherDerived>

View File

@@ -212,13 +212,13 @@ struct ei_trisolve_selector<Lhs,Rhs,Upper,ColMajor>
}
};
/** "in-place" version of MatrixBase::inverseProduct() where the result is written in \a other
/** "in-place" version of MatrixBase::solveTriangular() where the result is written in \a other
*
* \sa inverseProduct()
* \sa solveTriangular()
*/
template<typename Derived>
template<typename OtherDerived>
void MatrixBase<Derived>::inverseProductInPlace(MatrixBase<OtherDerived>& other) const
void MatrixBase<Derived>::solveTriangularInPlace(MatrixBase<OtherDerived>& other) const
{
ei_assert(derived().cols() == derived().rows());
ei_assert(derived().cols() == other.rows());
@@ -244,10 +244,10 @@ void MatrixBase<Derived>::inverseProductInPlace(MatrixBase<OtherDerived>& other)
*/
template<typename Derived>
template<typename OtherDerived>
typename OtherDerived::Eval MatrixBase<Derived>::inverseProduct(const MatrixBase<OtherDerived>& other) const
typename OtherDerived::Eval MatrixBase<Derived>::solveTriangular(const MatrixBase<OtherDerived>& other) const
{
typename OtherDerived::Eval res(other);
inverseProductInPlace(res);
solveTriangularInPlace(res);
return res;
}

View File

@@ -257,7 +257,7 @@ void LU<MatrixType>::computeKernel(Matrix<typename MatrixType::Scalar,
m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<Upper>()
.inverseProductInPlace(y);
.solveTriangularInPlace(y);
for(int i = 0; i < m_rank; i++)
result->row(m_q.coeff(i)) = y.row(i);
@@ -309,7 +309,7 @@ bool LU<MatrixType>::solve(
l.setZero();
l.corner(Eigen::TopLeft,rows,smalldim)
= m_lu.corner(Eigen::TopLeft,rows,smalldim);
l.template marked<UnitLower>().inverseProductInPlace(c);
l.template marked<UnitLower>().solveTriangularInPlace(c);
// Step 3
if(!isSurjective())
@@ -326,7 +326,7 @@ bool LU<MatrixType>::solve(
d(c.corner(TopLeft, m_rank, c.cols()));
m_lu.corner(TopLeft, m_rank, m_rank)
.template marked<Upper>()
.inverseProductInPlace(d);
.solveTriangularInPlace(d);
// Step 4
result->resize(m_lu.cols(), b.cols());

View File

@@ -230,17 +230,17 @@ compute(const MatrixType& matA, const MatrixType& matB, bool computeEigenvectors
Cholesky<MatrixType> cholB(matB);
// compute C = inv(U') A inv(U)
MatrixType matC = cholB.matrixL().inverseProduct(matA);
MatrixType matC = cholB.matrixL().solveTriangular(matA);
// FIXME since we currently do not support A * inv(U),
// let's do (inv(U') A')' :
matC = (cholB.matrixL().inverseProduct(matC.adjoint())).adjoint();
matC = (cholB.matrixL().solveTriangular(matC.adjoint())).adjoint();
compute(matC, computeEigenvectors);
if (computeEigenvectors)
{
// transform back the eigen vectors: evecs = inv(U) * evecs
m_eivec = cholB.matrixL().adjoint().template marked<Upper>().inverseProduct(m_eivec);
m_eivec = cholB.matrixL().adjoint().template marked<Upper>().solveTriangular(m_eivec);
}
}

View File

@@ -142,7 +142,7 @@ class SparseMatrixBase : public MatrixBase<Derived>
}
template<typename OtherDerived>
OtherDerived inverseProduct(const MatrixBase<OtherDerived>& other) const;
OtherDerived solveTriangular(const MatrixBase<OtherDerived>& other) const;
protected:

View File

@@ -155,7 +155,7 @@ struct ei_sparse_trisolve_selector<Lhs,Rhs,Upper,ColMajor>
template<typename Derived>
template<typename OtherDerived>
OtherDerived SparseMatrixBase<Derived>::inverseProduct(const MatrixBase<OtherDerived>& other) const
OtherDerived SparseMatrixBase<Derived>::solveTriangular(const MatrixBase<OtherDerived>& other) const
{
ei_assert(derived().cols() == other.rows());
ei_assert(!(Flags & ZeroDiagBit));