Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Drop zero blocks during uncombining #55

Open
mtfishman opened this issue Dec 10, 2020 · 0 comments
Open

Drop zero blocks during uncombining #55

mtfishman opened this issue Dec 10, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mtfishman
Copy link
Member

Uncombining can "generate" nonzero blocks:

using ITensors

i = Index(QN(0,2)=>2,QN(1,2)=>2; tags="i")
j = settags(i,"j")
A = emptyITensor(i,j,dag(i'))
A[1,1,1] = 1.0 
C = combiner(i, j; tags="c")
AC = A * C
Ap = AC * dag(C)

@show A
@show Ap

gives:

A = ITensor ord=3
Dim 1: (dim=4|id=251|"i") <Out>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
Dim 2: (dim=4|id=251|"j") <Out>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
Dim 3: (dim=4|id=251|"i")' <In>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
NDTensors.BlockSparse{Float64,Array{Float64,1},3}
 4×4×4
Block: Block{3}((0x0000000000000001, 0x0000000000000001, 0x0000000000000001), 0x8324cf5639de3e67)
 [1:2, 1:2, 1:2]
[:, :, 1] =
 1.0  0.0
 0.0  0.0

[:, :, 2] =
 0.0  0.0
 0.0  0.0

Ap = ITensor ord=3
Dim 1: (dim=4|id=251|"i") <Out>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
Dim 2: (dim=4|id=251|"j") <Out>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
Dim 3: (dim=4|id=251|"i")' <In>
 1: QN(0,2) => 2
 2: QN(1,2) => 2
NDTensors.BlockSparse{Float64,Array{Float64,1},3}
 4×4×4
Block: Block{3}((0x0000000000000001, 0x0000000000000001, 0x0000000000000001), 0x8324cf5639de3e67)
 [1:2, 1:2, 1:2]
[:, :, 1] =
 1.0  0.0
 0.0  0.0

[:, :, 2] =
 0.0  0.0
 0.0  0.0

Block: Block{3}((0x0000000000000002, 0x0000000000000002, 0x0000000000000001), 0x8681cd10e233a627)
 [3:4, 3:4, 1:2]
[:, :, 1] =
 0.0  0.0
 0.0  0.0

[:, :, 2] =
 0.0  0.0
 0.0  0.0

We could check for zero blocks here and drop them. However, checking every block for zeros may not be a cost we want to impose every time an uncombiner is used.

Since it is inconvenient to pass tolerances to contract, we could be very strict with the tolerance there, and then provide a dropzeros[!] function for NDTensors and ITensors.

@mtfishman mtfishman self-assigned this Dec 10, 2020
@mtfishman mtfishman added the enhancement New feature or request label Dec 10, 2020
@mtfishman mtfishman changed the title Drop nonzero blocks during uncombining Drop zero blocks during uncombining Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant