// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Benoit Jacob // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see . #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