From 44861dcbfeee041223c4aac1ee075e92fa4daa01 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Sep 2016 12:42:15 +0200 Subject: update --- eigen/Eigen/src/Eigen2Support/LU.h | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 eigen/Eigen/src/Eigen2Support/LU.h (limited to 'eigen/Eigen/src/Eigen2Support/LU.h') diff --git a/eigen/Eigen/src/Eigen2Support/LU.h b/eigen/Eigen/src/Eigen2Support/LU.h new file mode 100644 index 0000000..49f19ad --- /dev/null +++ b/eigen/Eigen/src/Eigen2Support/LU.h @@ -0,0 +1,120 @@ +// 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 -- cgit v1.2.3