Image.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 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_MISC_IMAGE_H
00011 #define EIGEN_MISC_IMAGE_H
00012 
00013 namespace Eigen { 
00014 
00015 namespace internal {
00016 
00020 template<typename DecompositionType>
00021 struct traits<image_retval_base<DecompositionType> >
00022 {
00023   typedef typename DecompositionType::MatrixType MatrixType;
00024   typedef Matrix<
00025     typename MatrixType::Scalar,
00026     MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose
00027                                    // dimension is the number of rows of the original matrix
00028     Dynamic,                       // we don't know at compile time the dimension of the image (the rank)
00029     MatrixType::Options,
00030     MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix,
00031     MatrixType::MaxColsAtCompileTime  // so it has the same number of rows and at most as many columns.
00032   > ReturnType;
00033 };
00034 
00035 template<typename _DecompositionType> struct image_retval_base
00036  : public ReturnByValue<image_retval_base<_DecompositionType> >
00037 {
00038   typedef _DecompositionType DecompositionType;
00039   typedef typename DecompositionType::MatrixType MatrixType;
00040   typedef ReturnByValue<image_retval_base> Base;
00041   typedef typename Base::Index Index;
00042 
00043   image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix)
00044     : m_dec(dec), m_rank(dec.rank()),
00045       m_cols(m_rank == 0 ? 1 : m_rank),
00046       m_originalMatrix(originalMatrix)
00047   {}
00048 
00049   inline Index rows() const { return m_dec.rows(); }
00050   inline Index cols() const { return m_cols; }
00051   inline Index rank() const { return m_rank; }
00052   inline const DecompositionType& dec() const { return m_dec; }
00053   inline const MatrixType& originalMatrix() const { return m_originalMatrix; }
00054 
00055   template<typename Dest> inline void evalTo(Dest& dst) const
00056   {
00057     static_cast<const image_retval<DecompositionType>*>(this)->evalTo(dst);
00058   }
00059 
00060   protected:
00061     const DecompositionType& m_dec;
00062     Index m_rank, m_cols;
00063     const MatrixType& m_originalMatrix;
00064 };
00065 
00066 } // end namespace internal
00067 
00068 #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \
00069   typedef typename DecompositionType::MatrixType MatrixType; \
00070   typedef typename MatrixType::Scalar Scalar; \
00071   typedef typename MatrixType::RealScalar RealScalar; \
00072   typedef typename MatrixType::Index Index; \
00073   typedef Eigen::internal::image_retval_base<DecompositionType> Base; \
00074   using Base::dec; \
00075   using Base::originalMatrix; \
00076   using Base::rank; \
00077   using Base::rows; \
00078   using Base::cols; \
00079   image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
00080     : Base(dec, originalMatrix) {}
00081 
00082 } // end namespace Eigen
00083 
00084 #endif // EIGEN_MISC_IMAGE_H


turtlebot_exploration_3d
Author(s): Bona , Shawn
autogenerated on Thu Jun 6 2019 20:58:31