File indexing completed on 2025-01-19 09:52:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EIGEN_MISC_KERNEL_H
0011 #define EIGEN_MISC_KERNEL_H
0012
0013 namespace Eigen {
0014
0015 namespace internal {
0016
0017
0018
0019
0020 template<typename DecompositionType>
0021 struct traits<kernel_retval_base<DecompositionType> >
0022 {
0023 typedef typename DecompositionType::MatrixType MatrixType;
0024 typedef Matrix<
0025 typename MatrixType::Scalar,
0026 MatrixType::ColsAtCompileTime,
0027
0028
0029 Dynamic,
0030 MatrixType::Options,
0031 MatrixType::MaxColsAtCompileTime,
0032 MatrixType::MaxColsAtCompileTime
0033
0034 > ReturnType;
0035 };
0036
0037 template<typename _DecompositionType> struct kernel_retval_base
0038 : public ReturnByValue<kernel_retval_base<_DecompositionType> >
0039 {
0040 typedef _DecompositionType DecompositionType;
0041 typedef ReturnByValue<kernel_retval_base> Base;
0042
0043 explicit kernel_retval_base(const DecompositionType& dec)
0044 : m_dec(dec),
0045 m_rank(dec.rank()),
0046 m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
0047 {}
0048
0049 inline Index rows() const { return m_dec.cols(); }
0050 inline Index cols() const { return m_cols; }
0051 inline Index rank() const { return m_rank; }
0052 inline const DecompositionType& dec() const { return m_dec; }
0053
0054 template<typename Dest> inline void evalTo(Dest& dst) const
0055 {
0056 static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
0057 }
0058
0059 protected:
0060 const DecompositionType& m_dec;
0061 Index m_rank, m_cols;
0062 };
0063
0064 }
0065
0066 #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
0067 typedef typename DecompositionType::MatrixType MatrixType; \
0068 typedef typename MatrixType::Scalar Scalar; \
0069 typedef typename MatrixType::RealScalar RealScalar; \
0070 typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
0071 using Base::dec; \
0072 using Base::rank; \
0073 using Base::rows; \
0074 using Base::cols; \
0075 kernel_retval(const DecompositionType& dec) : Base(dec) {}
0076
0077 }
0078
0079 #endif