Skip to content

Commit

Permalink
Remove print, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallerb committed Sep 10, 2024
1 parent d21b833 commit d322c15
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/affine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function affine_transform_mpo(
# Fill the MPO, taking care to not include auxiliary links at the edges
mpo = MPO(R)
spin_dims = ntuple(_ -> 2, M + N)
println(size.(tensors))
mpo[1] = ITensor(reshape(tensors[1], size(tensors[1], 2), spin_dims...),
(link[1], outsite[1,:]..., insite[1,:]...))
for r in 2:R-1
Expand Down Expand Up @@ -171,12 +170,16 @@ function affine_mpo_to_matrix(
prev_warn_order = ITensors.disable_warn_order()
try
mpo_contr = reduce(*, mpo)

# Given some variables (x, y), we have to bring the indices in the
# order (xR, ..., x1, yR, ..., y1) in order to have y = (y1 ... yR)_2
# once we reshape a column-major array and match the order of the
# variables in the full matrix.
out_indices = vec(reverse(outsite, dims=1))
in_indices = vec(reverse(insite, dims=1))
println(out_indices)
println(in_indices)
tensor = Array(mpo_contr, out_indices..., in_indices...)
matrix = reshape(tensor, 1 << length(out_indices), 1 << length(in_indices))
matrix = reshape(tensor,
1 << length(out_indices), 1 << length(in_indices))
return matrix
finally
ITensors.set_warn_order(prev_warn_order)
Expand Down

0 comments on commit d322c15

Please sign in to comment.