You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like in Eigen, we should have an optimisation with expression templates. Right now the library creates temporary matrices/vectors for each operation. The paper says that we are allowed to return what we think is best from the four overloaded operators (+,- (negation and subtraction) and *) defined in arithmetic_operators.hpp. My idea is to return an expression template, eigen style, for example addition:
template<classOT, classET1, classOT1, classET2, classOT2>
structmatrix_addition_traits<OT, matrix<ET1, OT1>, matrix<ET2, OT2>>
{
// not sure yet how these lines would have to changeusing engine_type = matrix_addition_engine_t<OT, ET1, ET2>;
using op_traits = OT;
using result_type = matrix<engine_type, op_traits>;
matrix_addition_traits(matrix<ET1, OT1> const& m1, matrix<ET2, OT2> const& m2): lhs(m1), rhs(m2) {}
// do the actual calculationautooperator ()(typename result_type::index_type i, typename result_type::index_type j)
{
returnlhs(i, j) + rhs(i, j);
}
// hold reference to lhs and rhs matricesconst matrix<ET1, OT1>& lhs;
const matrix<ET2, OT2>& rhs;
// syntatic sugar that calls the constructor (rather than calculate the value explicitly with allocation)staticautoadd(matrix<ET1, OT1> const& m1, matrix<ET2, OT2> const& m2);
};
would be good to discuss a bit how we could achieve this and remain compliant with P1385. It seems like they used Eigen quite a bit as a design inspiration, so this should be doable.
The text was updated successfully, but these errors were encountered:
Like in Eigen, we should have an optimisation with expression templates. Right now the library creates temporary matrices/vectors for each operation. The paper says that we are allowed to return what we think is best from the four overloaded operators (
+
,-
(negation and subtraction) and*
) defined in arithmetic_operators.hpp. My idea is to return an expression template, eigen style, for example addition:would be good to discuss a bit how we could achieve this and remain compliant with P1385. It seems like they used Eigen quite a bit as a design inspiration, so this should be doable.
The text was updated successfully, but these errors were encountered: