[ITensors] [ENHANCEMENT] Sparse output for `onehot`
Opened this issue · 1 comments
The onehot
function currently outputs a dense tensor which is not very efficient to contract. Ideally, this function would output an ITensor with sparse storage.
It seems like there is not yet an NDTensor TensorStorage type which implements a sparse array though I see that there is movement in overhauling the TensorStorage system (#1250).
Yes, we are doing a complete rewrite of NDTensors
which will replace the Tensor
type and TensorStorage
types. The new design will include a general elementwise SparseArrayDOK
type (using a dictionary-of-keys format), a new BlockSparseArray
type, a new DiagonalArray
type, along with better support for array slicing of all of those types. With better support for slicing it would mitigate the need for onehot
in the first place, since slicing is the main use case for it. The plan would be to base onehot
on SparseArrayDOK
or the OneElement
type from FillArrays.jl and use slicing under the hood for tensor contraction.