You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a proposal to use ITensor{N}() as an alternative syntax for constructing an ITensor with Empty storage and N indices. This could also be written as emptyITensor(Val{N}) or emptyITensor(Order{N}) to make it clearer that an Empty storage is being created (where struct Order{N} end could be a type we introduce like Val that is used as a compile-time order of a tensor).
For example, ITensor{Any}() could be another way to write emptyITensor(Any). Also, ITensor{3}() could be a syntax for making an ITensor with Empty storage of order 3 with unspecified indices. This could be useful for doing in-place operations where you don't want to specify the indices:
A =ITensor{2}() # ITensor with Empty storage and 2 unspecified indices
i =Index(2)
A[i =>1, i'=>2] =2.5# This makes an ITensor with indices (i, i')
and:
A =ITensor{3}()
i =Index(2)
for _ in1:5
A .+=randomITensor(i,i',i'')
end
Yes, I think good to have these. It’s nice we can strike a balance between having to specify the exact indices of an empty ITensor versus having to just use ITensor{Any}() for every situation where they aren’t known ahead of time.
This is a proposal to use
ITensor{N}()
as an alternative syntax for constructing an ITensor withEmpty
storage andN
indices. This could also be written asemptyITensor(Val{N})
oremptyITensor(Order{N})
to make it clearer that anEmpty
storage is being created (wherestruct Order{N} end
could be a type we introduce likeVal
that is used as a compile-time order of a tensor).For example,
ITensor{Any}()
could be another way to writeemptyITensor(Any)
. Also,ITensor{3}()
could be a syntax for making an ITensor withEmpty
storage of order3
with unspecified indices. This could be useful for doing in-place operations where you don't want to specify the indices:and:
(Note this builds off of PR #348).
The text was updated successfully, but these errors were encountered: