Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_MISC_KERNEL_H
00026 #define EIGEN_MISC_KERNEL_H
00027
00028 namespace Eigen {
00029
00030 namespace internal {
00031
00035 template<typename DecompositionType>
00036 struct traits<kernel_retval_base<DecompositionType> >
00037 {
00038 typedef typename DecompositionType::MatrixType MatrixType;
00039 typedef Matrix<
00040 typename MatrixType::Scalar,
00041 MatrixType::ColsAtCompileTime,
00042
00043
00044 Dynamic,
00045 MatrixType::Options,
00046 MatrixType::MaxColsAtCompileTime,
00047 MatrixType::MaxColsAtCompileTime
00048
00049 > ReturnType;
00050 };
00051
00052 template<typename _DecompositionType> struct kernel_retval_base
00053 : public ReturnByValue<kernel_retval_base<_DecompositionType> >
00054 {
00055 typedef _DecompositionType DecompositionType;
00056 typedef ReturnByValue<kernel_retval_base> Base;
00057 typedef typename Base::Index Index;
00058
00059 kernel_retval_base(const DecompositionType& dec)
00060 : m_dec(dec),
00061 m_rank(dec.rank()),
00062 m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
00063 {}
00064
00065 inline Index rows() const { return m_dec.cols(); }
00066 inline Index cols() const { return m_cols; }
00067 inline Index rank() const { return m_rank; }
00068 inline const DecompositionType& dec() const { return m_dec; }
00069
00070 template<typename Dest> inline void evalTo(Dest& dst) const
00071 {
00072 static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
00073 }
00074
00075 protected:
00076 const DecompositionType& m_dec;
00077 Index m_rank, m_cols;
00078 };
00079
00080 }
00081
00082 #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
00083 typedef typename DecompositionType::MatrixType MatrixType; \
00084 typedef typename MatrixType::Scalar Scalar; \
00085 typedef typename MatrixType::RealScalar RealScalar; \
00086 typedef typename MatrixType::Index Index; \
00087 typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
00088 using Base::dec; \
00089 using Base::rank; \
00090 using Base::rows; \
00091 using Base::cols; \
00092 kernel_retval(const DecompositionType& dec) : Base(dec) {}
00093
00094 }
00095
00096 #endif // EIGEN_MISC_KERNEL_H