How to do X * diag(Y)
in Scala Breeze? X
could be for example a CSCMatrix
and Y
could be a DenseVector
?
In MATLAB syntax, this would be:
X * spdiags(0, Y, N, N )
Or:
X .* repmat( Y', K, 0 )
In SciPy syntax, this would be a 'broadcast multiply':
Y * X
How to do X * diag(Y)
in Scala Breeze?
I wrote my own sparse diagonal method, and dense / sparse multiplication method in the end.
Use like this:
Here are the implementations of spdiag and mul: