Improve readibility of EIGEN_DEBUG_ASSIGN mode.

This commit is contained in:
Gael Guennebaud 2015-10-27 10:38:49 +01:00
parent 9f721384e0
commit 0fc8954282
3 changed files with 39 additions and 33 deletions

View File

@ -125,8 +125,8 @@ public:
std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl;
std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl;
std::cerr.setf(std::ios::hex, std::ios::basefield);
EIGEN_DEBUG_VAR(DstFlags)
EIGEN_DEBUG_VAR(SrcFlags)
std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl;
std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl;
std::cerr.unsetf(std::ios::hex);
EIGEN_DEBUG_VAR(DstAlignment)
EIGEN_DEBUG_VAR(SrcAlignment)
@ -141,11 +141,11 @@ public:
EIGEN_DEBUG_VAR(MayInnerVectorize)
EIGEN_DEBUG_VAR(MayLinearVectorize)
EIGEN_DEBUG_VAR(MaySliceVectorize)
EIGEN_DEBUG_VAR(Traversal)
std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl;
EIGEN_DEBUG_VAR(UnrollingLimit)
EIGEN_DEBUG_VAR(MayUnrollCompletely)
EIGEN_DEBUG_VAR(MayUnrollInner)
EIGEN_DEBUG_VAR(Unrolling)
std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl;
std::cerr << std::endl;
}
#endif

View File

@ -670,6 +670,38 @@ template<typename T> struct is_same_or_void<void,T> { enum { value = 1 }; };
template<typename T> struct is_same_or_void<T,void> { enum { value = 1 }; };
template<> struct is_same_or_void<void,void> { enum { value = 1 }; };
#ifdef EIGEN_DEBUG_ASSIGN
std::string demangle_traversal(int t)
{
if(t==DefaultTraversal) return "DefaultTraversal";
if(t==LinearTraversal) return "LinearTraversal";
if(t==InnerVectorizedTraversal) return "InnerVectorizedTraversal";
if(t==LinearVectorizedTraversal) return "LinearVectorizedTraversal";
if(t==SliceVectorizedTraversal) return "SliceVectorizedTraversal";
return "?";
}
std::string demangle_unrolling(int t)
{
if(t==NoUnrolling) return "NoUnrolling";
if(t==InnerUnrolling) return "InnerUnrolling";
if(t==CompleteUnrolling) return "CompleteUnrolling";
return "?";
}
std::string demangle_flags(int f)
{
std::string res;
if(f&RowMajorBit) res += " | RowMajor";
if(f&PacketAccessBit) res += " | Packet";
if(f&LinearAccessBit) res += " | Linear";
if(f&LvalueBit) res += " | Lvalue";
if(f&DirectAccessBit) res += " | Direct";
if(f&NestByRefBit) res += " | NestByRef";
if(f&NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit";
return res;
}
#endif
} // end namespace internal
// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor

View File

@ -11,35 +11,9 @@
#include "main.h"
#include <typeinfo>
std::string demangle_traversal(int t)
{
if(t==DefaultTraversal) return "DefaultTraversal";
if(t==LinearTraversal) return "LinearTraversal";
if(t==InnerVectorizedTraversal) return "InnerVectorizedTraversal";
if(t==LinearVectorizedTraversal) return "LinearVectorizedTraversal";
if(t==SliceVectorizedTraversal) return "SliceVectorizedTraversal";
return "?";
}
std::string demangle_unrolling(int t)
{
if(t==NoUnrolling) return "NoUnrolling";
if(t==InnerUnrolling) return "InnerUnrolling";
if(t==CompleteUnrolling) return "CompleteUnrolling";
return "?";
}
std::string demangle_flags(int f)
{
std::string res;
if(f&RowMajorBit) res += " | RowMajor";
if(f&PacketAccessBit) res += " | Packet";
if(f&LinearAccessBit) res += " | Linear";
if(f&LvalueBit) res += " | Lvalue";
if(f&DirectAccessBit) res += " | Direct";
if(f&NestByRefBit) res += " | NestByRef";
if(f&NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit";
return res;
}
using internal::demangle_flags;
using internal::demangle_traversal;
using internal::demangle_unrolling;
template<typename Dst, typename Src>
bool test_assign(const Dst&, const Src&, int traversal, int unrolling)