Fixes #22. At least on my local machine.
Created by: twesterhout
The reason for segfaults in general_product_impl
is this line:
auto vtilde = lhs.my_matrix() * rhs;
my_matrix()
member function returned a temporary which was destructed
after the assignment (see Eigen's docs page about the use of auto
).
You were then trying to access an already destructed matrix in line 101
which, obviously, didn't go well.
There are numerous solutions to this issue, but the simplest one that as
a by-product should also increase the performance, is to let my_matrix
return a reference to the stored matrix rather than a copy.