Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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,
00027
00028 Dynamic,
00029 MatrixType::Options,
00030 MatrixType::MaxRowsAtCompileTime,
00031 MatrixType::MaxColsAtCompileTime
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 }
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 }
00083
00084 #endif // EIGEN_MISC_IMAGE_H