add important comment and move stride helpers to DenseCoeffsBase.h

This commit is contained in:
Benoit Jacob 2010-05-09 09:41:54 -04:00
parent 8f076f6817
commit 6624b93d67
2 changed files with 29 additions and 24 deletions

View File

@ -26,30 +26,6 @@
#ifndef EIGEN_DENSEBASE_H
#define EIGEN_DENSEBASE_H
template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
struct ei_inner_stride_at_compile_time
{
enum { ret = ei_traits<Derived>::InnerStrideAtCompileTime };
};
template<typename Derived>
struct ei_inner_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
struct ei_outer_stride_at_compile_time
{
enum { ret = ei_traits<Derived>::OuterStrideAtCompileTime };
};
template<typename Derived>
struct ei_outer_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
/** \class DenseBase
*
* \brief Base class for all dense matrices, vectors, and arrays

View File

@ -214,6 +214,11 @@ class DenseCoeffsBase : public EigenBase<Derived>
}
protected:
// explanation: DenseBase is doing "using ..." on the methods from DenseCoeffsBase.
// But some methods are only available in the EnableDirectAccessAPI case.
// So we add dummy methods here with these names, so that "using... " doesn't fail.
// It's not private so that the child class DenseBase can access them, and it's not public
// either since it's an implementation detail, so has to be protected.
void coeffRef();
void coeffRefByOuterInner();
void writePacket();
@ -570,4 +575,28 @@ inline static int ei_first_aligned(const Derived& m)
::run(m);
}
template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
struct ei_inner_stride_at_compile_time
{
enum { ret = ei_traits<Derived>::InnerStrideAtCompileTime };
};
template<typename Derived>
struct ei_inner_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret>
struct ei_outer_stride_at_compile_time
{
enum { ret = ei_traits<Derived>::OuterStrideAtCompileTime };
};
template<typename Derived>
struct ei_outer_stride_at_compile_time<Derived, false>
{
enum { ret = 0 };
};
#endif // EIGEN_COEFFS_H