Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New QN ITensor constructors #418

Closed
mtfishman opened this issue Jun 4, 2020 · 1 comment
Closed

New QN ITensor constructors #418

mtfishman opened this issue Jun 4, 2020 · 1 comment
Assignees
Labels
api Issues related to the interface NDTensors Requires changes to the NDTensors.jl library. qns QN related issue
Milestone

Comments

@mtfishman
Copy link
Member

mtfishman commented Jun 4, 2020

It would be nice to have QN ITensor constructors that can make multiple blocks at once, instead of block-by-block with setindex! for all possible blocks by specifying the flux. For example:

i = Index(QN(0) => 2, QN(1) => 2; tags="i")
j = Index(QN(0) => 2, QN(1) => 2; tags="j")
ITensor([Block(1,1), Block(2,2)], i, dag(j))  # Create ITensor with nonzero blocks (1,1) and (2,2)
ITensor([(i => 1, j => 2, 12), (i => 4, j => 4, 44)], i, dag(j)) # Create ITensor with nonzero blocks (1,1) and (2,2) and the specified elements set

Also, it would be nice to think about an interface for indexing within a block (i.e. instead of (i => 4, j => 4), set the (2, 2) element of block (2, 2)), like the BlockIndex interface discussed here: ITensor/NDTensors.jl/issues/9

@mtfishman
Copy link
Member Author

An alternative to the second constructor could be a special way of setting elements:

T = emptyITensor(i, dag(j))
T[[(i => 1, j => 2), (i => 4, j => 4)]] .= [12, 44]

or with shorter notations:

T[(i, j) => [(1, 2), (4, 4)]] .= [12, 44]
T[[(1, 2), (4, 4)]] .= [12, 44]

@mtfishman mtfishman self-assigned this Oct 8, 2020
@mtfishman mtfishman added api Issues related to the interface NDTensors Requires changes to the NDTensors.jl library. qns QN related issue labels Oct 8, 2020
@mtfishman mtfishman added this to the v0.3 milestone Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the interface NDTensors Requires changes to the NDTensors.jl library. qns QN related issue
Projects
None yet
Development

No branches or pull requests

1 participant