* Implement the ByOuterInner accessors

* use them (big simplification in Assign.h)
* axe (Inner|Outer)StrideAtCompileTime that were just introduced
* ei_int_if_dynamic now asserts that the size is the expected one: adapt to that in Block.h
* add rowStride() / colStride() in DenseBase
* implement innerStride() / outerStride() everywhere needed
This commit is contained in:
Benoit Jacob
2010-02-25 21:01:52 -05:00
parent 5491531a81
commit 769641bc58
28 changed files with 236 additions and 285 deletions

View File

@@ -54,20 +54,6 @@ class Stride
inline int inner() const { return m_inner.value(); }
inline int outer() const { return m_outer.value(); }
template<int OtherInnerStrideAtCompileTime, int OtherOuterStrideAtCompileTime>
Stride<EIGEN_ENUM_MAX(InnerStrideAtCompileTime, OtherInnerStrideAtCompileTime),
EIGEN_ENUM_MAX(OuterStrideAtCompileTime, OtherOuterStrideAtCompileTime)>
operator|(const Stride<OtherInnerStrideAtCompileTime, OtherOuterStrideAtCompileTime>& other)
{
EIGEN_STATIC_ASSERT(!((InnerStrideAtCompileTime && OtherInnerStrideAtCompileTime)
|| (OuterStrideAtCompileTime && OtherOuterStrideAtCompileTime)),
YOU_ALREADY_SPECIFIED_THIS_STRIDE)
int result_inner = InnerStrideAtCompileTime ? inner() : other.inner();
int result_outer = OuterStrideAtCompileTime ? outer() : other.outer();
return Stride<EIGEN_ENUM_MAX(InnerStrideAtCompileTime, OtherInnerStrideAtCompileTime),
EIGEN_ENUM_MAX(OuterStrideAtCompileTime, OtherOuterStrideAtCompileTime)>
(result_inner, result_outer);
}
protected:
ei_int_if_dynamic<InnerStrideAtCompileTime> m_inner;
ei_int_if_dynamic<OuterStrideAtCompileTime> m_outer;
@@ -91,46 +77,4 @@ class OuterStride : public Stride<0, Value>
OuterStride(int v) : Base(0,v) {}
};
template<typename T, bool HasDirectAccess = int(ei_traits<T>::Flags)&DirectAccessBit>
struct ei_outer_stride_or_outer_size_impl
{
static inline int value(const T& x) { return x.outerStride(); }
};
template<typename T>
struct ei_outer_stride_or_outer_size_impl<T, false>
{
static inline int value(const T& x) { return x.outerSize(); }
};
template<typename T>
inline int ei_outer_stride_or_outer_size(const T& x)
{
return ei_outer_stride_or_outer_size_impl<T>::value(x);
}
template<typename T, bool HasDirectAccess = int(ei_traits<typename ei_cleantype<T>::type>::Flags)&DirectAccessBit>
struct ei_inner_stride_at_compile_time
{
enum { ret = ei_traits<typename ei_cleantype<T>::type>::InnerStrideAtCompileTime };
};
template<typename T>
struct ei_inner_stride_at_compile_time<T, false>
{
enum { ret = 1 };
};
template<typename T, bool HasDirectAccess = int(ei_traits<typename ei_cleantype<T>::type>::Flags)&DirectAccessBit>
struct ei_outer_stride_at_compile_time
{
enum { ret = ei_traits<typename ei_cleantype<T>::type>::OuterStrideAtCompileTime };
};
template<typename T>
struct ei_outer_stride_at_compile_time<T, false>
{
enum { ret = 1 };
};
#endif // EIGEN_STRIDE_H