90 template<
typename _PlainObjectType,
int _Options,
typename _Str
ideType>
91 struct traits<
Ref<_PlainObjectType, _Options, _StrideType> >
92 :
public traits<Map<_PlainObjectType, _Options, _StrideType> >
100 template<
typename Derived>
struct match {
103 StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || ((PlainObjectType::Flags&
RowMajorBit)==(Derived::Flags&
RowMajorBit)),
104 InnerStrideMatch =
int(StrideType::InnerStrideAtCompileTime)==int(
Dynamic)
105 || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
106 || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
107 OuterStrideMatch = Derived::IsVectorAtCompileTime
108 ||
int(StrideType::OuterStrideAtCompileTime)==int(
Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
110 MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch
117 template<
typename Derived>
122 template<
typename Derived>
class RefBase 135 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
140 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
141 : IsVectorAtCompileTime ? this->size()
142 : int(Flags)&RowMajorBit ? this->cols()
147 : Base(0,RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime),
149 m_stride(StrideType::OuterStrideAtCompileTime==
Dynamic?0:StrideType::OuterStrideAtCompileTime,
150 StrideType::InnerStrideAtCompileTime==
Dynamic?0:StrideType::InnerStrideAtCompileTime)
159 template<
typename Expression>
162 if(PlainObjectType::RowsAtCompileTime==1)
165 ::new (static_cast<Base*>(
this)) Base(expr.data(), 1, expr.size());
167 else if(PlainObjectType::ColsAtCompileTime==1)
170 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.size(), 1);
173 ::new (static_cast<Base*>(
this)) Base(expr.data(), expr.rows(), expr.cols());
174 ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(),
175 StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride());
182 template<
typename PlainObjectType,
int Options,
typename Str
ideType>
class Ref 183 :
public RefBase<Ref<PlainObjectType, Options, StrideType> >
192 #ifndef EIGEN_PARSED_BY_DOXYGEN 193 template<
typename Derived>
195 typename internal::enable_if<
bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
197 Base::construct(expr);
199 template<
typename Derived>
202 int = Derived::ThisConstantIsPrivateInPlainObjectBase)
204 template<
typename Derived>
208 Base::construct(expr.const_cast_derived());
216 template<
typename TPlainObjectType,
int Options,
typename Str
ideType>
class Ref<const TPlainObjectType, Options, StrideType>
217 :
public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
225 template<typename Derived>
231 construct(expr.derived(),
typename Traits::template match<Derived>::type());
236 template<
typename Expression>
239 Base::construct(expr);
242 template<
typename Expression>
245 m_object.lazyAssign(expr);
246 Base::construct(m_object);
255 #endif // EIGEN_REF_H Ref(const DenseBase< Derived > &expr, typename internal::enable_if< bool(internal::is_lvalue< Derived >::value &&bool(Traits::template match< Derived >::MatchAtCompileTime)), Derived >::type *=0, int=Derived::ThisConstantIsPrivateInPlainObjectBase)
Stride< StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime > StrideBase
Base class for Map and Block expression with direct access.
Ref(PlainObjectBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0)
internal::traits< Ref > Traits
internal::traits< Ref > Traits
internal::traits< Derived >::PlainObjectType PlainObjectType
iterative scaling algorithm to equilibrate rows and column norms in matrices
const unsigned int RowMajorBit
Base class for all dense matrices, vectors, and arrays.
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
const unsigned int AlignedBit
void construct(const Expression &expr, internal::false_type)
Base class for all variables within the symbolic expressions family.
internal::conditional< MatchAtCompileTime, internal::true_type, internal::false_type >::type type
void construct(Expression &expr)
Dense storage base class for matrices and arrays.
Provides a generic way to set and pass user-specified options.
TPlainObjectType m_object
A matrix or vector expression mapping an existing expressions.
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Index outerStride() const
Convenience specialization of Stride to specify only an outer stride See class Map for some examples...
_PlainObjectType PlainObjectType
internal::traits< Ref< PlainObjectType, Options, StrideType > >::StrideType StrideType
void construct(const Expression &expr, internal::true_type)