Kernel.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_KERNEL_H
00011 #define EIGEN_MISC_KERNEL_H
00012 
00013 namespace Eigen { 
00014 
00015 namespace internal {
00016 
00020 template<typename DecompositionType>
00021 struct traits<kernel_retval_base<DecompositionType> >
00022 {
00023   typedef typename DecompositionType::MatrixType MatrixType;
00024   typedef Matrix<
00025     typename MatrixType::Scalar,
00026     MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix"
00027                                    // is the number of cols of the original matrix
00028                                    // so that the product "matrix * kernel = zero" makes sense
00029     Dynamic,                       // we don't know at compile-time the dimension of the kernel
00030     MatrixType::Options,
00031     MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
00032     MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space,
00033                                      // whose dimension is the number of columns of the original matrix
00034   > ReturnType;
00035 };
00036 
00037 template<typename _DecompositionType> struct kernel_retval_base
00038  : public ReturnByValue<kernel_retval_base<_DecompositionType> >
00039 {
00040   typedef _DecompositionType DecompositionType;
00041   typedef ReturnByValue<kernel_retval_base> Base;
00042   typedef typename Base::Index Index;
00043 
00044   kernel_retval_base(const DecompositionType& dec)
00045     : m_dec(dec),
00046       m_rank(dec.rank()),
00047       m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
00048   {}
00049 
00050   inline Index rows() const { return m_dec.cols(); }
00051   inline Index cols() const { return m_cols; }
00052   inline Index rank() const { return m_rank; }
00053   inline const DecompositionType& dec() const { return m_dec; }
00054 
00055   template<typename Dest> inline void evalTo(Dest& dst) const
00056   {
00057     static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
00058   }
00059 
00060   protected:
00061     const DecompositionType& m_dec;
00062     Index m_rank, m_cols;
00063 };
00064 
00065 } // end namespace internal
00066 
00067 #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
00068   typedef typename DecompositionType::MatrixType MatrixType; \
00069   typedef typename MatrixType::Scalar Scalar; \
00070   typedef typename MatrixType::RealScalar RealScalar; \
00071   typedef typename MatrixType::Index Index; \
00072   typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
00073   using Base::dec; \
00074   using Base::rank; \
00075   using Base::rows; \
00076   using Base::cols; \
00077   kernel_retval(const DecompositionType& dec) : Base(dec) {}
00078 
00079 } // end namespace Eigen
00080 
00081 #endif // EIGEN_MISC_KERNEL_H


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