ITensors.jl
ITensors.jl copied to clipboard
Sparse to dense conversion API
It would be good to think about the interface for converting from sparse ITensor types to Dense, or other less sparse types where it makes sense. It would be good to have the following operations, with some proposed names:
Convert to Dense:
- [x]
Diag -> Dense(dense) - [ ]
BlockSparse -> Dense(dense,removeqns) (denseis implemented but notremoveqns) - [x]
DiagBlockSparse -> Dense(dense)
Convert to Diag:
- [ ]
DiagBlockSparse -> Diag(diag,removeqns)
Convert to BlockSparse:
- [x]
DiagBlockSparse -> BlockSparse(denseblocks)
Right now, I believe all of the dense conversion functions are implemented (but none of the others are).
Also on a related note, it would be nice to have a function that acts like removeqns but within NDTensors, perhaps called removeblocks. This would do the conversions:
BlockSparse -> DenseDiagBlockSparse -> Diag
This will be useful for generic code, since then removeqns(::ITensor) can just call removeblocks(::Tensor).
I think these names and concepts are all great. It’s a good distinction to make that removing QNs doesn’t necessarily mean going all the way to dense storage, because there may be other kinds of sparsity involved like diagonal sparsity. If we find a good application (data science?) of general sparsity that will be another situation that can be composed with block sparsity too.
If we do need better names later, we can always make them synonyms for some of these (soft deprecation).