Move from `SparseArrays` to a package with multidimensional sparse array support?
There's currently a `sparsematrix.jl` file here and a `sparse.jl` file in QuantumInterface with functions extending `SparseArrays` with:
- some `gemm!` and `gemv!` functions
- `_permutedims` which works on arrays with ndims > 2 as `SparseArrays` only implements `permutedims` for ndims = 2
- `ptrace`
I wasn't able to find much evidence that `SparseArrays` has plans to support anything other than vectors and matrices. [The docs even list](https://docs.julialang.org/en/v1/stdlib/SparseArrays/#Noteworthy-External-Sparse-Packages) some external packages that handle multidimensional arrays. Several of these seem to offer interfaces that could help simplify the code we have here. For example, anything offering an Einstein summation notation interface would make `ptrace` a one-liner.
[`Finch.jl`](https://github.com/finch-tensor/Finch.jl) is perhaps the most interesting one on the list for our use cases and potential to offer significant speedups. Also it might be possible to use its `lazy` feature as part of the `Lazy{Ket,Product,Sum,Tensor}`. However, it's still lacking some basic features we would want here [like `reshape`](https://github.com/finch-tensor/Finch.jl/issues/558).
A better library for multidimensional sparse arrays would be especially helpful for having cleaner code for the all the superoperator support I'm working on as it would hopefully avoid [issues like this](https://github.com/qojulia/QuantumOpticsBase.jl/blob/86fbdebab2eeb8dc4a3170e6fe9c8aa097d22d8b/src/superoperators.jl#L361) (relevant issue: https://github.com/JuliaSparse/SparseArrays.jl/issues/24).
3 条评论