Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get outer product of a sparse vector and a dense vector #779

Closed
csnardi opened this issue May 3, 2020 · 2 comments · Fixed by #780
Closed

Cannot get outer product of a sparse vector and a dense vector #779

csnardi opened this issue May 3, 2020 · 2 comments · Fixed by #780

Comments

@csnardi
Copy link

csnardi commented May 3, 2020

Attempting to get the outer product of a sparse vector and a dense vector by themselves fails. For instance:

val a = breeze.linalg.DenseVector.zeros[Double](250)
val b = breeze.linalg.SparseVector.zeros[Double](300)
a * b.t
<console>:28: error: could not find implicit value for parameter op: breeze.linalg.operators.OpMulMatrix.Impl2[breeze.linalg.DenseVector[Double],breeze.linalg.Transpose[breeze.linalg.SparseVector[Double]],That]
       a * b.t

However, this works perfectly fine when the sparse vector is converted to a dense vector first:

res14: a * b.toDenseVector.t
breeze.linalg.DenseMatrix[Double] =
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ... (300 total)
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ...
0.0  0.0  0...
@bluesheeptoken
Copy link
Contributor

This is probably due to the ambiguity of this operation. Would you expect to have a Dense matrix or a Sparse Matrix ?

@dlwh Any idea on that ? Would it be better to left it unimplemented ? Calculate a Sparse Matrix ? I might have some free time to implement it if there is a decision taken

@dlwh
Copy link
Member

dlwh commented May 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants