mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add dot product, extend meta unrolling everywhere
This commit is contained in:
@@ -27,37 +27,44 @@
|
||||
#ifndef EI_COPYHELPER_H
|
||||
#define EI_COPYHELPER_H
|
||||
|
||||
template<int UnrollCount, int Rows> class EiCopyHelperUnroller
|
||||
template<int UnrollCount, int Rows> struct EiCopyHelperUnroller
|
||||
{
|
||||
static const int col = (UnrollCount-1) / Rows;
|
||||
static const int row = (UnrollCount-1) % Rows;
|
||||
static const int col = (UnrollCount-1) / Rows;
|
||||
static const int row = (UnrollCount-1) % Rows;
|
||||
|
||||
public:
|
||||
template <typename Derived1, typename Derived2>
|
||||
static void run(Derived1 &dst, const Derived2 &src)
|
||||
{
|
||||
EiCopyHelperUnroller<UnrollCount-1, Rows>::run(dst, src);
|
||||
dst.write(row, col) = src.read(row, col);
|
||||
}
|
||||
template <typename Derived1, typename Derived2>
|
||||
static void run(Derived1 &dst, const Derived2 &src)
|
||||
{
|
||||
EiCopyHelperUnroller<UnrollCount-1, Rows>::run(dst, src);
|
||||
dst.write(row, col) = src.read(row, col);
|
||||
}
|
||||
};
|
||||
|
||||
template<int Rows> class EiCopyHelperUnroller<0, Rows>
|
||||
template<int Rows> struct EiCopyHelperUnroller<0, Rows>
|
||||
{
|
||||
public:
|
||||
template <typename Derived1, typename Derived2>
|
||||
static void run(Derived1 &dst, const Derived2 &src)
|
||||
{
|
||||
EI_UNUSED(dst);
|
||||
EI_UNUSED(src);
|
||||
}
|
||||
template <typename Derived1, typename Derived2>
|
||||
static void run(Derived1 &dst, const Derived2 &src)
|
||||
{
|
||||
dst.write(0, 0) = src.read(0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
template<int Rows> struct EiCopyHelperUnroller<EiDynamic, Rows>
|
||||
{
|
||||
template <typename Derived1, typename Derived2>
|
||||
static void run(Derived1 &dst, const Derived2 &src)
|
||||
{
|
||||
EI_UNUSED(dst);
|
||||
EI_UNUSED(src);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar, typename Derived>
|
||||
template<typename OtherDerived>
|
||||
void EiObject<Scalar, Derived>::_copy_helper(const EiObject<Scalar, OtherDerived>& other)
|
||||
{
|
||||
if(UnrollCount > 0 && UnrollCount <= EI_LOOP_UNROLLING_LIMIT)
|
||||
EiCopyHelperUnroller<UnrollCount, RowsAtCompileTime>::run(*this, other);
|
||||
if(SizeAtCompileTime != EiDynamic && SizeAtCompileTime <= EI_LOOP_UNROLLING_LIMIT)
|
||||
EiCopyHelperUnroller<SizeAtCompileTime, RowsAtCompileTime>::run(*this, other);
|
||||
else
|
||||
for(int i = 0; i < rows(); i++)
|
||||
for(int j = 0; j < cols(); j++)
|
||||
|
||||
Reference in New Issue
Block a user