adapt to coding style used elsewhere in eigen2

This commit is contained in:
Benoit Jacob 2007-10-01 04:57:51 +00:00
parent 2d823d8ef6
commit e116aba444

View File

@ -28,36 +28,36 @@
#include "Util.h" #include "Util.h"
template<int count, int rows> class Loop template<int Size, int Rows> class EiLoop
{ {
enum { static const int col = (Size-1) / Rows;
col = (count-1)/rows, static const int row = (Size-1) % Rows;
row = (count-1)%rows,
next = count-1
};
public: public:
template <typename Derived1, typename Derived2> static void copy(Derived1 &dst, const Derived2 &src) template <typename Derived1, typename Derived2>
static void copy(Derived1 &dst, const Derived2 &src)
{ {
Loop<next, rows>::copy(dst, src); EiLoop<Size-1, Rows>::copy(dst, src);
dst.write(row, col) = src.read(row, col); dst.write(row, col) = src.read(row, col);
} }
}; };
template<int rows> class Loop<0, rows>
template<int Rows> class EiLoop<0, Rows>
{ {
public: public:
template <typename Derived1, typename Derived2> static void copy(Derived1 &dst, const Derived2 &src) template <typename Derived1, typename Derived2>
static void copy(Derived1 &dst, const Derived2 &src)
{ {
EI_UNUSED(dst); EI_UNUSED(dst);
EI_UNUSED(src); EI_UNUSED(src);
} }
}; };
template<typename Scalar, typename Derived> class EiObject template<typename Scalar, typename Derived> class EiObject
{ {
static const int RowsAtCompileTime = Derived::RowsAtCompileTime, static const int RowsAtCompileTime = Derived::RowsAtCompileTime,
ColsAtCompileTime = Derived::ColsAtCompileTime, ColsAtCompileTime = Derived::ColsAtCompileTime,
CountAtCompileTime= RowsAtCompileTime*ColsAtCompileTime > 0 ? SizeAtCompileTime = RowsAtCompileTime*ColsAtCompileTime > 0 ?
RowsAtCompileTime*ColsAtCompileTime : 0; RowsAtCompileTime*ColsAtCompileTime : 0;
template<typename OtherDerived> template<typename OtherDerived>
@ -65,8 +65,8 @@ template<typename Scalar, typename Derived> class EiObject
{ {
if ((RowsAtCompileTime != EiDynamic) && if ((RowsAtCompileTime != EiDynamic) &&
(ColsAtCompileTime != EiDynamic) && (ColsAtCompileTime != EiDynamic) &&
(CountAtCompileTime <= 25)) (SizeAtCompileTime <= 25))
Loop<CountAtCompileTime, RowsAtCompileTime>::copy(*this, other); EiLoop<SizeAtCompileTime, RowsAtCompileTime>::copy(*this, other);
else else
for(int i = 0; i < rows(); i++) for(int i = 0; i < rows(); i++)
for(int j = 0; j < cols(); j++) for(int j = 0; j < cols(); j++)