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

Sparse to dense conversion API

Open mtfishman opened this issue 5 years ago • 2 comments

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) (dense is implemented but not removeqns)
  • [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).

mtfishman avatar May 04 '20 19:05 mtfishman

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 -> Dense
  • DiagBlockSparse -> Diag

This will be useful for generic code, since then removeqns(::ITensor) can just call removeblocks(::Tensor).

mtfishman avatar May 04 '20 20:05 mtfishman

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).

emstoudenmire avatar May 13 '20 18:05 emstoudenmire