Skip to content

Commit

Permalink
Cleaned up hacky rotate_north method that is not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrehmer committed Apr 3, 2024
1 parent 15687b1 commit 7d8ed73
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
2 changes: 1 addition & 1 deletion examples/test_gauge_fixing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test_gauge_fixing(randn, ComplexF64, P, V, E; χenv, unitcell=(1, 1))
test_gauge_fixing(randn, ComplexF64, P, V, E; χenv, unitcell=(2, 2))
test_gauge_fixing(randn, ComplexF64, P, V, E; χenv, unitcell=(3, 4)) # check gauge-fixing for unit cells > (2, 2)

# Convergence of real CTMRG seems to be more sensitive to initial guesse
# Convergence of real CTMRG seems to be more sensitive to initial guess
test_gauge_fixing(randn, Float64, P, V, E; χenv, unitcell=(1, 1))
test_gauge_fixing(randn, Float64, P, V, E; χenv, unitcell=(2, 2))
test_gauge_fixing(randn, Float64, P, V, E; χenv, unitcell=(3, 4))
Expand Down
19 changes: 0 additions & 19 deletions src/utility/rotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,3 @@ const SOUTHWEST = 4

# Rotate tensor to any direction by successive application of Base.rotl90
rotate_north(t, dir) = mod1(dir, 4) == NORTH ? t : rotate_north(rotl90(t), dir - 1)

# Hacked version for AbstractArray{T,3} which doesn't need to overload rotl90 to avoid type piracy
function rotate_north(A::AbstractArray{T,3}, dir) where {T}
for _ in 1:(mod1(dir, size(A, 1)) - 1)
# Initialize copy with rotated sizes
A′ = Zygote.Buffer(Array{T,3}(undef, size(A, 1), size(A, 3), size(A, 2)))
for dir in 1:size(A, 1)
# A′[_prev(dir, size(A, 1)), :, :] = rotl90(A[dir, :, :])
# throws setindex! error for non-symmetric unit cells
rA = rotl90(A[dir, :, :])
for r in 1:size(A, 3), c in 1:size(A, 2)
A′[_prev(dir, size(A, 1)), r, c] = rA[r, c]
end
end
A = A′
end

return copy(A)
end

0 comments on commit 7d8ed73

Please sign in to comment.