16 template<
typename PlainObjectType,
int Options = 0,
90 template<
typename _PlainObjectType,
int _Options,
typename _Str
ideType>
91 struct traits<
Ref<_PlainObjectType, _Options, _StrideType> >
92 :
public traits<Map<_PlainObjectType, _Options, _StrideType> >
94 typedef _PlainObjectType PlainObjectType;
95 typedef _StrideType StrideType;
101 template<
typename Derived>
struct match {
104 StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&
RowMajorBit)==(Derived::Flags&
RowMajorBit)),
105 InnerStrideMatch =
int(StrideType::InnerStrideAtCompileTime)==int(
Dynamic)
106 || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
107 || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
108 OuterStrideMatch = Derived::IsVectorAtCompileTime
109 ||
int(StrideType::OuterStrideAtCompileTime)==int(
Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
112 MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch
119 template<
typename Derived>
124 template<
typename Derived>
class RefBase 133 EIGEN_DENSE_PUBLIC_INTERFACE(
RefBase)
135 inline Index innerStride()
const 137 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
140 inline Index outerStride()
const 142 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
143 : IsVectorAtCompileTime ? this->
size()
149 : Base(0,RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime),
151 m_stride(StrideType::OuterStrideAtCompileTime==
Dynamic?0:StrideType::OuterStrideAtCompileTime,
152 StrideType::InnerStrideAtCompileTime==
Dynamic?0:StrideType::InnerStrideAtCompileTime)
155 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
RefBase)
161 template<
typename Expression>
162 void construct(Expression& expr)
164 if(PlainObjectType::RowsAtCompileTime==1)
166 eigen_assert(expr.rows()==1 || expr.cols()==1);
167 ::new (static_cast<Base*>(
this)) Base(expr.data(), 1, expr.size());
169 else if(PlainObjectType::ColsAtCompileTime==1)
171 eigen_assert(expr.rows()==1 || expr.cols()==1);
172 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.size(), 1);
175 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.rows(), expr.cols());
177 if(Expression::IsVectorAtCompileTime && (!PlainObjectType::IsVectorAtCompileTime) && ((Expression::Flags&
RowMajorBit)!=(PlainObjectType::Flags&
RowMajorBit)))
178 ::new (&m_stride) StrideBase(expr.innerStride(), StrideType::InnerStrideAtCompileTime==0?0:1);
180 ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(),
181 StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride());
188 template<
typename PlainObjectType,
int Options,
typename Str
ideType>
class Ref 189 :
public RefBase<Ref<PlainObjectType, Options, StrideType> >
193 template<
typename Derived>
195 typename internal::enable_if<
bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0);
199 EIGEN_DENSE_PUBLIC_INTERFACE(
Ref)
202 #ifndef EIGEN_PARSED_BY_DOXYGEN 203 template<
typename Derived>
205 typename internal::enable_if<
bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
207 EIGEN_STATIC_ASSERT(static_cast<bool>(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
208 Base::construct(expr.derived());
210 template<
typename Derived>
212 typename internal::enable_if<
bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
214 template<
typename Derived>
219 EIGEN_STATIC_ASSERT(static_cast<bool>(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
220 enum { THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY = Derived::ThisConstantIsPrivateInPlainObjectBase};
221 Base::construct(expr.const_cast_derived());
224 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Ref)
229 template<
typename TPlainObjectType,
int Options,
typename Str
ideType>
class Ref<const TPlainObjectType, Options, StrideType>
230 :
public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
236 EIGEN_DENSE_PUBLIC_INTERFACE(
Ref)
238 template<
typename Derived>
240 typename internal::enable_if<
bool(Traits::template match<Derived>::ScalarTypeMatch),Derived>::type* = 0)
245 construct(expr.derived(),
typename Traits::template match<Derived>::type());
248 inline Ref(
const Ref& other) : Base(other) {
252 template<
typename OtherRef>
254 construct(other.derived(),
typename Traits::template match<OtherRef>::type());
259 template<
typename Expression>
262 Base::construct(expr);
265 template<
typename Expression>
268 m_object.lazyAssign(expr);
269 Base::construct(m_object);
273 TPlainObjectType m_object;
278 #endif // EIGEN_REF_H Definition: gtest_unittest.cc:5031
Base class for Map and Block expression with direct access.
Definition: ForwardDeclarations.h:109
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
Object is aligned for vectorization.
Definition: Constants.h:194
const unsigned int AlignedBit
means the first coefficient packet is guaranteed to be aligned
Definition: Constants.h:147
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:88
Definition: ForwardDeclarations.h:25
A matrix or vector expression mapping an existing expressions.
Definition: Ref.h:17
Definition: BandTriangularSolver.h:13
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:459
Definition: osvr_print_tree.cpp:52