Kernel.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_KERNEL_H
11 #define EIGEN_MISC_KERNEL_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
20 template<typename DecompositionType>
21 struct traits<kernel_retval_base<DecompositionType> >
22 {
24  typedef Matrix<
25  typename MatrixType::Scalar,
26  MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix"
27  // is the number of cols of the original matrix
28  // so that the product "matrix * kernel = zero" makes sense
29  Dynamic, // we don't know at compile-time the dimension of the kernel
30  MatrixType::Options,
31  MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
32  MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space,
33  // whose dimension is the number of columns of the original matrix
35 };
36 
37 template<typename _DecompositionType> struct kernel_retval_base
38  : public ReturnByValue<kernel_retval_base<_DecompositionType> >
39 {
40  typedef _DecompositionType DecompositionType;
42 
44  : m_dec(dec),
45  m_rank(dec.rank()),
46  m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
47  {}
48 
49  inline Index rows() const { return m_dec.cols(); }
50  inline Index cols() const { return m_cols; }
51  inline Index rank() const { return m_rank; }
52  inline const DecompositionType& dec() const { return m_dec; }
53 
54  template<typename Dest> inline void evalTo(Dest& dst) const
55  {
56  static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
57  }
58 
59  protected:
62 };
63 
64 } // end namespace internal
65 
66 #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
67  typedef typename DecompositionType::MatrixType MatrixType; \
68  typedef typename MatrixType::Scalar Scalar; \
69  typedef typename MatrixType::RealScalar RealScalar; \
70  typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
71  using Base::dec; \
72  using Base::rank; \
73  using Base::rows; \
74  using Base::cols; \
75  kernel_retval(const DecompositionType& dec) : Base(dec) {}
76 
77 } // end namespace Eigen
78 
79 #endif // EIGEN_MISC_KERNEL_H
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::ReturnByValue
Definition: ReturnByValue.h:50
Eigen::internal::kernel_retval_base::m_rank
Index m_rank
Definition: Kernel.h:61
MatrixType
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Eigen::internal::kernel_retval_base::DecompositionType
_DecompositionType DecompositionType
Definition: Kernel.h:40
Eigen::internal::kernel_retval_base
Definition: ForwardDeclarations.h:138
Eigen::internal::kernel_retval_base::rows
Index rows() const
Definition: Kernel.h:49
Eigen::internal::traits< kernel_retval_base< DecompositionType > >::ReturnType
Matrix< typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, Dynamic, MatrixType::Options, MatrixType::MaxColsAtCompileTime, MatrixType::MaxColsAtCompileTime > ReturnType
Definition: Kernel.h:34
Eigen::internal::kernel_retval_base::m_cols
Index m_cols
Definition: Kernel.h:61
Eigen::internal::kernel_retval_base::m_dec
const DecompositionType & m_dec
Definition: Kernel.h:60
Eigen::Dynamic
const int Dynamic
Definition: Constants.h:22
Eigen::internal::kernel_retval_base::kernel_retval_base
kernel_retval_base(const DecompositionType &dec)
Definition: Kernel.h:43
Eigen::internal::kernel_retval_base::rank
Index rank() const
Definition: Kernel.h:51
Eigen::internal::kernel_retval
Definition: ForwardDeclarations.h:139
Eigen::internal::kernel_retval_base::evalTo
void evalTo(Dest &dst) const
Definition: Kernel.h:54
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::internal::kernel_retval_base::dec
const DecompositionType & dec() const
Definition: Kernel.h:52
Eigen::internal::kernel_retval_base::cols
Index cols() const
Definition: Kernel.h:50
Eigen::internal::traits< kernel_retval_base< DecompositionType > >::MatrixType
DecompositionType::MatrixType MatrixType
Definition: Kernel.h:23
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
internal
Definition: BandTriangularSolver.h:13
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
Eigen::internal::kernel_retval_base::Base
ReturnByValue< kernel_retval_base > Base
Definition: Kernel.h:41


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