68 EIGEN_DENSE_PUBLIC_INTERFACE(
RefBase)
70 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index innerStride()
const
72 return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.
inner() : 1;
75 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride()
const
77 return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.
outer()
78 : IsVectorAtCompileTime ? this->size()
84 :
Base(0,RowsAtCompileTime==
Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==
Dynamic?0:ColsAtCompileTime),
86 m_stride(StrideType::OuterStrideAtCompileTime==
Dynamic?0:StrideType::OuterStrideAtCompileTime,
87 StrideType::InnerStrideAtCompileTime==
Dynamic?0:StrideType::InnerStrideAtCompileTime)
90 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
RefBase)
97 static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index resolveInnerStride(
Index inner) {
98 return inner == 0 ? 1 : inner;
108 template<
typename Expression>
109 EIGEN_DEVICE_FUNC
bool construct(
Expression& expr)
114 EIGEN_PREDICATE_SAME_MATRIX_SIZE(PlainObjectType,
Expression)
116 || ( PlainObjectType::IsVectorAtCompileTime
119 ||
int(PlainObjectType::RowsAtCompileTime)==
int(Expression::ColsAtCompileTime))
122 ||
int(PlainObjectType::ColsAtCompileTime)==
int(Expression::RowsAtCompileTime)))),
123 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES
127 Index rows = expr.rows();
128 Index cols = expr.cols();
129 if(PlainObjectType::RowsAtCompileTime==1)
131 eigen_assert(expr.rows()==1 || expr.cols()==1);
135 else if(PlainObjectType::ColsAtCompileTime==1)
137 eigen_assert(expr.rows()==1 || expr.cols()==1);
143 (PlainObjectType::RowsAtCompileTime ==
Dynamic) || (PlainObjectType::RowsAtCompileTime == rows));
145 (PlainObjectType::ColsAtCompileTime ==
Dynamic) || (PlainObjectType::ColsAtCompileTime == cols));
149 const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows());
163 Expression::IsVectorAtCompileTime != 0,
172 ( StrideType::InnerStrideAtCompileTime > 0 ?
Index(StrideType::InnerStrideAtCompileTime) : 1)
179 ( StrideType::OuterStrideAtCompileTime > 0 ?
Index(StrideType::OuterStrideAtCompileTime) : rows * cols *
inner_stride)
184 || (resolveInnerStride(
Index(StrideType::InnerStrideAtCompileTime)) ==
inner_stride);
190 || (resolveOuterStride(
192 Index(StrideType::OuterStrideAtCompileTime),
193 rows, cols, PlainObjectType::IsVectorAtCompileTime != 0,
200 ::new (
static_cast<Base*
>(
this))
Base(expr.data(), rows, cols);
202 (StrideType::OuterStrideAtCompileTime == 0) ? 0 :
outer_stride,
203 (StrideType::InnerStrideAtCompileTime == 0) ? 0 :
inner_stride );
281template<
typename PlainObjectType,
int Options,
typename Str
ideType>
class Ref
282 :
public RefBase<Ref<PlainObjectType, Options, StrideType> >
286 template<
typename Derived>
292 EIGEN_DENSE_PUBLIC_INTERFACE(
Ref)
295 #ifndef EIGEN_PARSED_BY_DOXYGEN
296 template<
typename Derived>
302 const bool success = Base::construct(expr.derived());
306 template<
typename Derived>
311 template<
typename Derived>
317 EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
319 const bool success = Base::construct(expr.const_cast_derived());
324 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(
Ref)
329template<
typename TPlainObjectType,
int Options,
typename Str
ideType>
class Ref<
const TPlainObjectType, Options, StrideType>
330 :
public RefBase<Ref<const TPlainObjectType, Options, StrideType> >
336 EIGEN_DENSE_PUBLIC_INTERFACE(
Ref)
338 template<
typename Derived>
348 EIGEN_DEVICE_FUNC
inline Ref(
const Ref& other) :
Base(other) {
352 template<
typename OtherRef>
359 template<
typename Expression>
363 if (!Base::construct(expr)) {
368 template<
typename Expression>
372 Base::construct(m_object);
376 TPlainObjectType m_object;
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66