Distances.jl icon indicating copy to clipboard operation
Distances.jl copied to clipboard

Support for sparse vectors/matrices

Open quinnj opened this issue 11 years ago • 7 comments

It'd be great if support for sparse vectors/matrices could be made to work.

quinnj avatar Sep 15 '14 14:09 quinnj

I've wanted this a lot recently while working with sparse document-term matrices.

johnmyleswhite avatar Sep 16 '14 05:09 johnmyleswhite

My use case exactly! I'll poke around with it, but it seemed there were view implementations missing, amongst other things, so not just a matter of defining a method or two.

quinnj avatar Sep 16 '14 09:09 quinnj

PRs are welcomed. But I don't have much time working on this in near term.

lindahua avatar Sep 16 '14 12:09 lindahua

Is there any specific reason that At_mul_b for two sparse matrices multiplication not implemented in base/linalg/sparse.jl? I had to bypass At_mul_b via spmatmul to leverage pairwise work with sparse matrices, though the performance is not as blazing fast as using dense matrices.

For @quinnj 's view problem, Tim Holy pointed out SubArrays support views of sparse matrices.

With the two inconsistent and ugly modifications above on pairwise, one can merely make it work, whereas further work is still needed.

toddleo avatar Dec 03 '14 07:12 toddleo

Until type coverage for in-place in-place functions isn't decided, how about using InplaceOps for abstracting in-place functions?

wildart avatar Apr 13 '15 16:04 wildart

Fixing this issue might help in implementing this.

jlapeyre avatar Nov 27 '21 23:11 jlapeyre

I made a PR #235 to add a good bit of support for SparseVector, although it doesn't cover everything. In particular I did not support or even look into matrices.

jlapeyre avatar Nov 30 '21 17:11 jlapeyre