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 namespace Eigen {
14 
15 namespace internal {
16 
20 template<typename DecompositionType>
21 struct traits<image_retval_base<DecompositionType> >
22 {
24  typedef Matrix<
25  typename MatrixType::Scalar,
26  MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose
27  // dimension is the number of rows of the original matrix
28  Dynamic, // we don't know at compile time the dimension of the image (the rank)
29  MatrixType::Options,
30  MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix,
31  MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns.
33 };
34 
35 template<typename _DecompositionType> struct image_retval_base
36  : public ReturnByValue<image_retval_base<_DecompositionType> >
37 {
38  typedef _DecompositionType DecompositionType;
41 
43  : m_dec(dec), m_rank(dec.rank()),
44  m_cols(m_rank == 0 ? 1 : m_rank),
46  {}
47 
48  inline Index rows() const { return m_dec.rows(); }
49  inline Index cols() const { return m_cols; }
50  inline Index rank() const { return m_rank; }
51  inline const DecompositionType& dec() const { return m_dec; }
52  inline const MatrixType& originalMatrix() const { return m_originalMatrix; }
53 
54  template<typename Dest> inline void evalTo(Dest& dst) const
55  {
56  static_cast<const image_retval<DecompositionType>*>(this)->evalTo(dst);
57  }
58 
59  protected:
63 };
64 
65 } // end namespace internal
66 
67 #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \
68  typedef typename DecompositionType::MatrixType MatrixType; \
69  typedef typename MatrixType::Scalar Scalar; \
70  typedef typename MatrixType::RealScalar RealScalar; \
71  typedef Eigen::internal::image_retval_base<DecompositionType> Base; \
72  using Base::dec; \
73  using Base::originalMatrix; \
74  using Base::rank; \
75  using Base::rows; \
76  using Base::cols; \
77  image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \
78  : Base(dec, originalMatrix) {}
79 
80 } // end namespace Eigen
81 
82 #endif // EIGEN_MISC_IMAGE_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::ReturnByValue
Definition: ReturnByValue.h:50
Eigen::internal::image_retval_base::m_dec
const DecompositionType & m_dec
Definition: Image.h:60
Eigen::internal::traits< image_retval_base< DecompositionType > >::ReturnType
Matrix< typename MatrixType::Scalar, MatrixType::RowsAtCompileTime, Dynamic, MatrixType::Options, MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime > ReturnType
Definition: Image.h:32
MatrixType
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Eigen::internal::image_retval_base::cols
Index cols() const
Definition: Image.h:49
Eigen::internal::traits< image_retval_base< DecompositionType > >::MatrixType
DecompositionType::MatrixType MatrixType
Definition: Image.h:23
Eigen::internal::image_retval_base::rank
Index rank() const
Definition: Image.h:50
Eigen::internal::image_retval_base::m_rank
Index m_rank
Definition: Image.h:61
Eigen::internal::image_retval_base::MatrixType
DecompositionType::MatrixType MatrixType
Definition: Image.h:39
Eigen::internal::image_retval
Definition: ForwardDeclarations.h:141
Eigen::internal::image_retval_base::rows
Index rows() const
Definition: Image.h:48
Eigen::Dynamic
const int Dynamic
Definition: Constants.h:22
Eigen::internal::image_retval_base::dec
const DecompositionType & dec() const
Definition: Image.h:51
Eigen::internal::image_retval_base::image_retval_base
image_retval_base(const DecompositionType &dec, const MatrixType &originalMatrix)
Definition: Image.h:42
Eigen::internal::image_retval_base::Base
ReturnByValue< image_retval_base > Base
Definition: Image.h:40
Eigen::internal::image_retval_base::originalMatrix
const MatrixType & originalMatrix() const
Definition: Image.h:52
Eigen::internal::image_retval_base::DecompositionType
_DecompositionType DecompositionType
Definition: Image.h:38
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::internal::image_retval_base::m_originalMatrix
const MatrixType & m_originalMatrix
Definition: Image.h:62
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
Eigen::internal::image_retval_base::evalTo
void evalTo(Dest &dst) const
Definition: Image.h:54
internal
Definition: BandTriangularSolver.h:13
Eigen::internal::image_retval_base::m_cols
Index m_cols
Definition: Image.h:61
Eigen::internal::image_retval_base
Definition: ForwardDeclarations.h:140
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:41