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_IMAGE_H
00026 #define EIGEN_MISC_IMAGE_H
00027
00028 namespace internal {
00029
00033 template<typename DecompositionType>
00034 struct traits<image_retval_base<DecompositionType> >
00035 {
00036 typedef typename DecompositionType::MatrixType MatrixType;
00037 typedef Matrix<
00038 typename MatrixType::Scalar,
00039 MatrixType::RowsAtCompileTime,
00040
00041 Dynamic,
00042 MatrixType::Options,
00043 MatrixType::MaxRowsAtCompileTime,
00044 MatrixType::MaxColsAtCompileTime
00045 > ReturnType;
00046 };
00047
00048 template<typename _DecompositionType> struct image_retval_base
00049 : public ReturnByValue<image_retval_base<_DecompositionType> >
00050 {
00051 typedef _DecompositionType DecompositionType;
00052 typedef typename DecompositionType::MatrixType MatrixType;
00053 typedef ReturnByValue<image_retval_base> Base;
00054 typedef typename Base::Index Index;
00055
00056 image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix)
00057 : m_dec(dec), m_rank(dec.rank()),
00058 m_cols(m_rank == 0 ? 1 : m_rank),
00059 m_originalMatrix(originalMatrix)
00060 {}
00061
00062 inline Index rows() const { return m_dec.rows(); }
00063 inline Index cols() const { return m_cols; }
00064 inline Index rank() const { return m_rank; }
00065 inline const DecompositionType& dec() const { return m_dec; }
00066 inline const MatrixType& originalMatrix() const { return m_originalMatrix; }
00067
00068 template<typename Dest> inline void evalTo(Dest& dst) const
00069 {
00070 static_cast<const image_retval<DecompositionType>*>(this)->evalTo(dst);
00071 }
00072
00073 protected:
00074 const DecompositionType& m_dec;
00075 Index m_rank, m_cols;
00076 const MatrixType& m_originalMatrix;
00077 };
00078
00079 }
00080
00081 #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \
00082 typedef typename DecompositionType::MatrixType MatrixType; \
00083 typedef typename MatrixType::Scalar Scalar; \
00084 typedef typename MatrixType::RealScalar RealScalar; \
00085 typedef typename MatrixType::Index Index; \
00086 typedef Eigen::internal::image_retval_base<DecompositionType> Base; \
00087 using Base::dec; \
00088 using Base::originalMatrix; \
00089 using Base::rank; \
00090 using Base::rows; \
00091 using Base::cols; \
00092 image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
00093 : Base(dec, originalMatrix) {}
00094
00095 #endif // EIGEN_MISC_IMAGE_H