// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN2_LU_H #define EIGEN2_LU_H namespace Eigen { template class LU : public FullPivLU { public: typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix IntRowVectorType; typedef Matrix IntColVectorType; typedef Matrix RowVectorType; typedef Matrix ColVectorType; typedef Matrix KernelResultType; typedef Matrix ImageResultType; typedef FullPivLU Base; template explicit LU(const T& t) : Base(t), m_originalMatrix(t) {} template bool solve(const MatrixBase& b, ResultType *result) const { *result = static_cast(this)->solve(b); return true; } template inline void computeInverse(ResultType *result) const { solve(MatrixType::Identity(this->rows(), this->cols()), result); } template void computeKernel(KernelMatrixType *result) const { *result = static_cast(this)->kernel(); } template void computeImage(ImageMatrixType *result) const { *result = static_cast(this)->image(m_originalMatrix); } const ImageResultType image() const { return static_cast(this)->image(m_originalMatrix); } const MatrixType& m_originalMatrix; }; #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS /** \lu_module * * Synonym of partialPivLu(). * * \return the partial-pivoting LU decomposition of \c *this. * * \sa class PartialPivLU */ template inline const LU::PlainObject> MatrixBase::lu() const { return LU(eval()); } #endif #ifdef EIGEN2_SUPPORT /** \lu_module * * Synonym of partialPivLu(). * * \return the partial-pivoting LU decomposition of \c *this. * * \sa class PartialPivLU */ template inline const LU::PlainObject> MatrixBase::eigen2_lu() const { return LU(eval()); } #endif } // end namespace Eigen #endif // EIGEN2_LU_H