Opened 5 years ago
Closed 3 years ago
#836 closed request (fixed)
allow operator*(const Matrix&, const Matrix&)
Reported by: | Peter | Owned by: | Peter |
---|---|---|---|
Priority: | major | Milestone: | yat 0.15 |
Component: | utility | Version: | |
Keywords: | Cc: |
Description (last modified by )
Needs ticket #474 Related to ticket #835
The API does not allow code like Matrix C = A * B
mainly because it would need to return by value, which is slow, and it is better to use
Matrix C(A); C *= B;
This argument does not really hold strong, once move constructors have been implemented for class Matrix
(see #474), because then, IIUC, the return from
operator*(const Matrix&, const Matrix&);
is light as a feather. and likewise the construction from the temp Matrix is also ultra lightweight.
Change History (7)
comment:1 Changed 3 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 3 years ago by
Milestone: | yat 0.x+ → yat 0.15 |
---|---|
Owner: | changed from Jari Häkkinen to Peter |
Type: | discussion → request |
comment:3 Changed 3 years ago by
Status: | new → assigned |
---|
comment:6 Changed 3 years ago by
(In [3605]) A first go at implementing template expression in order to provide fast linalg operators with a intuitive interface.
Currently these operators are implemented (far from a complete set) Vector + Vector Vector - Vector Vector * Vector Scalar * Vector Vector * Scalar Matrix * Vector Vector * Matrix Matrix + Matrix Matrix - Matrix Matrix * Matrix Scalar * Matrix Matrix * Scalar
refs #836
comment:7 Changed 3 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Matrix*Matrix is now implemented. I close this ticket and leave additions to the interface in other tickets.
The idea here is that
operator*(const Matrix& lhs, const Matrix& rhs)
does not return a Matrix. Instead it returns a Proxy class, which holds agsl_matrix*
that is calculated just likeblas_result_
inoperator*=
. Then if we provide assignment fromProxy&&
to Matrix we have multiplication that is as fast asoperator*=
.Having done this, we can generalize - using templates - to more complex expressions (such as A + B * C).