Image.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_MISC_IMAGE_H
11 #define EIGEN_MISC_IMAGE_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 
23 template <typename DecompositionType>
24 struct traits<image_retval_base<DecompositionType> > {
26  typedef Matrix<typename MatrixType::Scalar,
27  MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose
28  // dimension is the number of rows of the original matrix
29  Dynamic, // we don't know at compile time the dimension of the image (the rank)
31  MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original
32  // matrix,
33  MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns.
34  >
36 };
37 
38 template <typename DecompositionType_>
39 struct image_retval_base : public ReturnByValue<image_retval_base<DecompositionType_> > {
40  typedef DecompositionType_ DecompositionType;
43 
46 
47  inline Index rows() const { return m_dec.rows(); }
48  inline Index cols() const { return m_cols; }
49  inline Index rank() const { return m_rank; }
50  inline const DecompositionType& dec() const { return m_dec; }
51  inline const MatrixType& originalMatrix() const { return m_originalMatrix; }
52 
53  template <typename Dest>
54  inline void evalTo(Dest& dst) const {
55  static_cast<const image_retval<DecompositionType>*>(this)->evalTo(dst);
56  }
57 
58  protected:
62 };
63 
64 } // end namespace internal
65 
66 #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \
67  typedef typename DecompositionType::MatrixType MatrixType; \
68  typedef typename MatrixType::Scalar Scalar; \
69  typedef typename MatrixType::RealScalar RealScalar; \
70  typedef Eigen::internal::image_retval_base<DecompositionType> Base; \
71  using Base::dec; \
72  using Base::originalMatrix; \
73  using Base::rank; \
74  using Base::rows; \
75  using Base::cols; \
76  image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) : Base(dec, originalMatrix) {}
77 
78 } // end namespace Eigen
79 
80 #endif // EIGEN_MISC_IMAGE_H
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: ReturnByValue.h:50
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
Definition: Eigen_Colamd.h:49
const MatrixType & m_originalMatrix
Definition: Image.h:61
Index rows() const
Definition: Image.h:47
const DecompositionType & m_dec
Definition: Image.h:59
const MatrixType & originalMatrix() const
Definition: Image.h:51
Index m_cols
Definition: Image.h:60
void evalTo(Dest &dst) const
Definition: Image.h:54
const DecompositionType & dec() const
Definition: Image.h:50
ReturnByValue< image_retval_base > Base
Definition: Image.h:42
image_retval_base(const DecompositionType &dec, const MatrixType &originalMatrix)
Definition: Image.h:44
Index rank() const
Definition: Image.h:49
Index cols() const
Definition: Image.h:48
DecompositionType::MatrixType MatrixType
Definition: Image.h:41
Index m_rank
Definition: Image.h:60
DecompositionType_ DecompositionType
Definition: Image.h:40
Definition: ForwardDeclarations.h:207
DecompositionType::MatrixType MatrixType
Definition: Image.h:25
Matrix< typename MatrixType::Scalar, MatrixType::RowsAtCompileTime, Dynamic, traits< MatrixType >::Options, MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime > ReturnType
Definition: Image.h:35
Definition: ForwardDeclarations.h:21