Hi Jeff,
We don't have a specific sparse matrix constructor in the core.matrix API yet, ideally we would want something like:
(sparse-vector indexes values)
This is probably a sensible API addition, feel free to create an issue.
Currently you have two fairly decent options:
1. Use interop to call the underlying constructor in the implementation. In the :vectorz case you probably want:
(mikera.vectorz.impl.SparseIndexedVector/wrap (int length) (int-array indexes) (double-array values))
This will offer the best possible performance, in this case O(number of non-zero elements)
2. Create a mutable indexed vector and use mset! to set the individual non-zero elements, with something like:
(let [v (new-sparse-array :vectorz [length])]
(doseq [[index value] data]
(mset! v index value))
v)
This should be fine as long as you don't have too many non-zero elements, since mset! is typically going to be worse than O(1) for sparse vectors.
In the :vectorz case, this will be O((number of non-zero elements)^2))