Description
Is your feature request related to a problem? Please describe.
I would like to be able to use LinearAlgebra's 3 arguments dot
function to be able to do compute the dot product dot(x, A*y)
between two vectors x
and A*y
where A
is a matrix. Currently, the only way to do this is to call directly dot(x, A*y)
which works fine but stores in memory A*y
.
Describe the solution you'd like
The 3-args dot
is there as a performance optimization of dot(x, A*y)
, essentially because there is no intermediate result to store. Perhaps there could be a CUDA version of it?
Describe alternatives you've considered
Right now, I am managing by using the following (for now, I only need the dot product for Diagonal matrices, but I might some day need it for any matrix):
LinearAlgebra.dot(x::AbstractGPUArray, D::Diagonal,y::AbstractGPUArray) = dot(x,D*y)
Additional context
I guess my workaround could be added in the CUDA package (or perhaps GPUArrays, but I didn't see the 2-args dot
there, so we would need to start by that), but maybe it's better for the script to crash rather than to have non-optimal performance (which is, after all, why the 3-args dot
is there for). What would you prefer?