Solve.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #ifndef EIGEN_MISC_SOLVE_H
00026 #define EIGEN_MISC_SOLVE_H
00027 
00028 namespace internal {
00029 
00033 template<typename DecompositionType, typename Rhs>
00034 struct traits<solve_retval_base<DecompositionType, Rhs> >
00035 {
00036   typedef typename DecompositionType::MatrixType MatrixType;
00037   typedef Matrix<typename Rhs::Scalar,
00038                  MatrixType::ColsAtCompileTime,
00039                  Rhs::ColsAtCompileTime,
00040                  Rhs::PlainObject::Options,
00041                  MatrixType::MaxColsAtCompileTime,
00042                  Rhs::MaxColsAtCompileTime> ReturnType;
00043 };
00044 
00045 template<typename _DecompositionType, typename Rhs> struct solve_retval_base
00046  : public ReturnByValue<solve_retval_base<_DecompositionType, Rhs> >
00047 {
00048   typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
00049   typedef _DecompositionType DecompositionType;
00050   typedef ReturnByValue<solve_retval_base> Base;
00051   typedef typename Base::Index Index;
00052 
00053   solve_retval_base(const DecompositionType& dec, const Rhs& rhs)
00054     : m_dec(dec), m_rhs(rhs)
00055   {}
00056 
00057   inline Index rows() const { return m_dec.cols(); }
00058   inline Index cols() const { return m_rhs.cols(); }
00059   inline const DecompositionType& dec() const { return m_dec; }
00060   inline const RhsNestedCleaned& rhs() const { return m_rhs; }
00061 
00062   template<typename Dest> inline void evalTo(Dest& dst) const
00063   {
00064     static_cast<const solve_retval<DecompositionType,Rhs>*>(this)->evalTo(dst);
00065   }
00066 
00067   protected:
00068     const DecompositionType& m_dec;
00069     const typename Rhs::Nested m_rhs;
00070 };
00071 
00072 } // end namespace internal
00073 
00074 #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \
00075   typedef typename DecompositionType::MatrixType MatrixType; \
00076   typedef typename MatrixType::Scalar Scalar; \
00077   typedef typename MatrixType::RealScalar RealScalar; \
00078   typedef typename MatrixType::Index Index; \
00079   typedef Eigen::internal::solve_retval_base<DecompositionType,Rhs> Base; \
00080   using Base::dec; \
00081   using Base::rhs; \
00082   using Base::rows; \
00083   using Base::cols; \
00084   solve_retval(const DecompositionType& dec, const Rhs& rhs) \
00085     : Base(dec, rhs) {}
00086 
00087 #endif // EIGEN_MISC_SOLVE_H


libicr
Author(s): Robert Krug
autogenerated on Mon Jan 6 2014 11:33:26