Hi Christopher,
That shouldn't be too hard. Just define a custom scalar type and override all necessary operations, something along the line of:
template <typename T>
struct Printed
{
Printed(T x, const char* name) : x(x), name(name) {}
// ...
Printed operator+(Printed other)
{
std::cout << name << ": " << x << " + " <<
other.name << ": " << other.x << " = " << x+y << std::endl;
return x + y;
}
// ...
private:
T x;
std::string name;
};
Hello,
I'm interested in the internals of Eigen's _expression_ optimizations, in order to both optimize my usage of Eigen and to improve my overall programming techniques. Given some matrix _expression_ such as D=C+(A*B)^-1, I know Eigen doesn't actually execute anything
until the equals sign. Rather, Eigen's _expression_ templates generate an optimized set of calculations, combining steps to avoid temporaries and aliasing, for instance. Eigen also rearranges the computations to make them more amenable to compiler optimizations
like loop unrolling and autovectorization. But while I understand the general ideas, and the significance of each individual step, the complexity of both Eigen's and the compiler's optimizations are such that I have a hard time seeing the whole picture. Is
it possible to have an _expression_ somehow print out or save the final computation sequence chosen by the compiler? If that's not possible with Eigen on its own, is there some third-party tool, i.e. a debugger or disassembler, that I can use in conjunction
with Eigen which will record in human-readable format the executed computations? Thanks for your help,
-- Chris