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

Commit

Permalink
Replace explicit symbols for gensym(symbol)
Browse files Browse the repository at this point in the history
  • Loading branch information
jofrevalles committed Mar 13, 2024
1 parent 24a6fcb commit 92b0b4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Ansatz/Chain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ function isleftcanonical(qtn::Chain, site; atol::Real = 1e-12)

# we are at right-most site, we need to add an extra dummy dimension to the tensor
if isnothing(right_ind)
tensor = Tensor(reshape(parent(tensor), size(tensor)..., 1), (inds(tensor)..., :dummy_ind))
right_ind = :dummy_ind
right_ind = gensym(:dummy)
tensor = Tensor(reshape(parent(tensor), size(tensor)..., 1), (inds(tensor)..., right_ind))
end

# TODO is replace(conj(A)...) copying too much?
contracted = contract(tensor, replace(conj(tensor), right_ind => :new_ind_name))
contracted = contract(tensor, replace(conj(tensor), right_ind => gensym(:new_ind)))
n = size(tensor, right_ind)
identity_matrix = Matrix(I, n, n)

Expand All @@ -333,12 +333,12 @@ function isrightcanonical(qtn::Chain, site; atol::Real = 1e-12)

# we are at left-most site, we need to add an extra dummy dimension to the tensor
if isnothing(left_ind)
tensor = Tensor(reshape(parent(tensor), 1, size(tensor)...), (:dummy_ind, inds(tensor)...))
left_ind = :dummy_ind
left_ind = gensym(:dummy)
tensor = Tensor(reshape(parent(tensor), 1, size(tensor)...), (left_ind, inds(tensor)...))
end

#TODO is replace(conj(A)...) copying too much?
contracted = contract(tensor, replace(conj(tensor), left_ind => :new_ind_name))
contracted = contract(tensor, replace(conj(tensor), left_ind => gensym(:new_ind)))
n = size(tensor, left_ind)
identity_matrix = Matrix(I, n, n)

Expand Down

0 comments on commit 92b0b4a

Please sign in to comment.