ReshapedMethods.h
Go to the documentation of this file.
1 
2 #ifdef EIGEN_PARSED_BY_DOXYGEN
3 
30 template<int Order = ColMajor, typename NRowsType, typename NColsType>
32 inline Reshaped<Derived,...>
33 reshaped(NRowsType nRows, NColsType nCols);
34 
36 template<int Order = ColMajor, typename NRowsType, typename NColsType>
38 inline const Reshaped<const Derived,...>
39 reshaped(NRowsType nRows, NColsType nCols) const;
40 
61 template<int Order = ColMajor>
63 inline Reshaped<Derived,...>
65 
67 template<int Order = ColMajor>
69 inline const Reshaped<const Derived,...>
70 reshaped() const;
71 
72 #else
73 
74 // This file is automatically included twice to generate const and non-const versions
75 
76 #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS
77 #define EIGEN_RESHAPED_METHOD_CONST const
78 #else
79 #define EIGEN_RESHAPED_METHOD_CONST
80 #endif
81 
82 #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS
83 
84 // This part is included once
85 
86 #endif
87 
88 template<typename NRowsType, typename NColsType>
90 inline Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
91  internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
92  internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value>
93 reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST
94 {
95  return Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
96  internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
97  internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value>
98  (derived(),
101 }
102 
103 template<int Order, typename NRowsType, typename NColsType>
105 inline Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
106  internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
107  internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value,
109 reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST
110 {
111  return Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
112  internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
113  internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value,
115  (derived(),
118 }
119 
120 // Views as linear vectors
121 
123 inline Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,SizeAtCompileTime,1>
124 reshaped() EIGEN_RESHAPED_METHOD_CONST
125 {
126  return Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,SizeAtCompileTime,1>(derived(),size(),1);
127 }
128 
129 template<int Order>
131 inline Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived, SizeAtCompileTime, 1,
133 reshaped() EIGEN_RESHAPED_METHOD_CONST
134 {
135  EIGEN_STATIC_ASSERT(Order==RowMajor || Order==ColMajor || Order==AutoOrder, INVALID_TEMPLATE_PARAMETER);
136  return Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived, SizeAtCompileTime, 1,
138  (derived(), size(), 1);
139 }
140 
141 #undef EIGEN_RESHAPED_METHOD_CONST
142 
143 #ifndef EIGEN_RESHAPED_METHOD_2ND_PASS
144 #define EIGEN_RESHAPED_METHOD_2ND_PASS
145 #include "ReshapedMethods.h"
146 #undef EIGEN_RESHAPED_METHOD_2ND_PASS
147 #endif
148 
149 #endif // EIGEN_PARSED_BY_DOXYGEN
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
Reshaped< Derived,... > reshaped(NRowsType nRows, NColsType nCols)
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
@ ColMajor
Definition: Constants.h:321
@ RowMajor
Definition: Constants.h:323
Index get_runtime_reshape_size(SizeType size, Index, Index)
Index get_runtime_value(const T &x)
constexpr int get_compiletime_reshape_order(int flags, int order)
const int AutoOrder