Replicate.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-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
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_REPLICATE_H
11 #define EIGEN_REPLICATE_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 template<typename MatrixType,int RowFactor,int ColFactor>
17 struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
18  : traits<MatrixType>
19 {
20  typedef typename MatrixType::Scalar Scalar;
25  enum {
26  RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic
27  ? Dynamic
28  : RowFactor * MatrixType::RowsAtCompileTime,
29  ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic
30  ? Dynamic
31  : ColFactor * MatrixType::ColsAtCompileTime,
32  //FIXME we don't propagate the max sizes !!!
33  MaxRowsAtCompileTime = RowsAtCompileTime,
34  MaxColsAtCompileTime = ColsAtCompileTime,
35  IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
36  : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
37  : (MatrixType::Flags & RowMajorBit) ? 1 : 0,
38 
39  // FIXME enable DirectAccess with negative strides?
40  Flags = IsRowMajor ? RowMajorBit : 0
41  };
42 };
43 }
44 
61 template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
62  : public internal::dense_xpr_base< Replicate<MatrixType,RowFactor,ColFactor> >::type
63 {
66  public:
67 
70  typedef typename internal::remove_all<MatrixType>::type NestedExpression;
71 
72  template<typename OriginalMatrixType>
74  inline explicit Replicate(const OriginalMatrixType& matrix)
75  : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor)
76  {
78  THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
79  eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic);
80  }
81 
82  template<typename OriginalMatrixType>
84  inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor)
85  : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor)
86  {
88  THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
89  }
90 
92  inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); }
94  inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); }
95 
98  {
99  return m_matrix;
100  }
101 
102  protected:
106 };
107 
116 template<typename Derived>
117 template<int RowFactor, int ColFactor>
120 {
121  return Replicate<Derived,RowFactor,ColFactor>(derived());
122 }
123 
132 template<typename ExpressionType, int Direction>
135 {
137  (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1);
138 }
139 
140 } // end namespace Eigen
141 
142 #endif // EIGEN_REPLICATE_H
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
Eigen::internal::variable_if_dynamic< Index, RowFactor >
Eigen::internal::traits< Replicate< MatrixType, RowFactor, ColFactor > >::Scalar
MatrixType::Scalar Scalar
Definition: Replicate.h:20
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen::Replicate::Replicate
EIGEN_DEVICE_FUNC Replicate(const OriginalMatrixType &matrix, Index rowFactor, Index colFactor)
Definition: Replicate.h:84
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
MatrixType
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Eigen::DenseBase::replicate
const EIGEN_DEVICE_FUNC Replicate< Derived, RowFactor, ColFactor > replicate() const
Definition: Replicate.h:119
Eigen::Horizontal
@ Horizontal
Definition: Constants.h:267
Eigen::internal::dense_xpr_base
Definition: XprHelper.h:483
Eigen::Replicate::nestedExpression
const EIGEN_DEVICE_FUNC _MatrixTypeNested & nestedExpression() const
Definition: Replicate.h:97
eigen_assert
#define eigen_assert(x)
Definition: Macros.h:1037
Eigen::RowMajorBit
const unsigned int RowMajorBit
Definition: Constants.h:66
EIGEN_CONSTEXPR
#define EIGEN_CONSTEXPR
Definition: Macros.h:787
type
Definition: pytypes.h:1525
EIGEN_DENSE_PUBLIC_INTERFACE
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1283
Eigen::Replicate::rows
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const
Definition: Replicate.h:92
Eigen::Replicate::MatrixTypeNested
internal::traits< Replicate >::MatrixTypeNested MatrixTypeNested
Definition: Replicate.h:64
Eigen::Replicate::cols
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const
Definition: Replicate.h:94
Eigen::internal::traits< Replicate< MatrixType, RowFactor, ColFactor > >::XprKind
traits< MatrixType >::XprKind XprKind
Definition: Replicate.h:22
pruning_fixture::factor
DecisionTreeFactor factor(D &C &B &A, "0.0 0.0 0.0 0.60658897 0.61241912 0.61241969 0.61247685 0.61247742 0.0 " "0.0 0.0 0.99995287 1.0 1.0 1.0 1.0")
Eigen::Replicate::m_rowFactor
const internal::variable_if_dynamic< Index, RowFactor > m_rowFactor
Definition: Replicate.h:104
Eigen::VectorwiseOp::ReplicateReturnType
Replicate< ExpressionType,(isVertical?Dynamic:1),(isHorizontal?Dynamic:1)> ReplicateReturnType
Definition: VectorwiseOp.h:552
Eigen::Dynamic
const int Dynamic
Definition: Constants.h:22
Eigen::internal::variable_if_dynamic::value
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:135
Eigen::Replicate
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:61
Eigen::Triplet< double >
Eigen::Vertical
@ Vertical
Definition: Constants.h:264
Eigen::internal::ref_selector
Definition: XprHelper.h:416
Eigen::Replicate::m_matrix
MatrixTypeNested m_matrix
Definition: Replicate.h:103
matrix
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: gtsam/3rdparty/Eigen/blas/common.h:110
Eigen::Replicate::Base
internal::dense_xpr_base< Replicate >::type Base
Definition: Replicate.h:68
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
EIGEN_STATIC_ASSERT
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Eigen::Replicate::m_colFactor
const internal::variable_if_dynamic< Index, ColFactor > m_colFactor
Definition: Replicate.h:105
Eigen::VectorwiseOp::replicate
const EIGEN_DEVICE_FUNC ReplicateReturnType replicate(Index factor) const
Definition: Replicate.h:134
Eigen::internal::traits< Replicate< MatrixType, RowFactor, ColFactor > >::MatrixTypeNested
ref_selector< MatrixType >::type MatrixTypeNested
Definition: Replicate.h:23
Eigen::VectorwiseOp< const ArrayWrapper< ExpressionType >, Horizontal >::Index
Eigen::Index Index
Definition: VectorwiseOp.h:192
Eigen::internal::is_same
Definition: Meta.h:148
internal
Definition: BandTriangularSolver.h:13
Eigen::internal::traits< Replicate< MatrixType, RowFactor, ColFactor > >::_MatrixTypeNested
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
Definition: Replicate.h:24
Eigen::internal::traits< Replicate< MatrixType, RowFactor, ColFactor > >::StorageKind
traits< MatrixType >::StorageKind StorageKind
Definition: Replicate.h:21
Eigen::Replicate::_MatrixTypeNested
internal::traits< Replicate >::_MatrixTypeNested _MatrixTypeNested
Definition: Replicate.h:65
test_callbacks.value
value
Definition: test_callbacks.py:160
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:13:06