Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed Apr 10, 2024
1 parent 241e49f commit 1048294
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/contractions/central.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function batched_mul!(
sinter = sb * st * max(sl1 * sl2 * min(sr1, sr2), sr1 * sr2 * min(sl1, sl2))
if sl1 * sl2 * sr1 * sr2 < sinter
# @cast E[(l1, l2), (r1, r2)] :=
# M.e11[l1, r1] * M.e21[l2, r1] * M.e12[l1, r2] * M.e22[l2, r2]
# M.e11[l1, r1] * M.e21[l2, r1] * M.e12[l1, r2] * M.e22[l2, r2]
a11 = reshape(CuArray(M.e11), size(M.e11, 1), :, size(M.e11, 2))
a21 = reshape(CuArray(M.e21), :, size(M.e21, 1), size(M.e21, 2))
a12 = reshape(CuArray(M.e12), size(M.e12, 1), 1, 1, size(M.e12, 2))
Expand Down
2 changes: 1 addition & 1 deletion src/contractions/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ end

function contract_tensors43(B::Tensor{R,4}, A::Tensor{R,3}) where {R<:Real}
# @matmul C[(x, y), (b, a), z] := sum(σ) B[y, z, a, σ] * A[x, b, σ]
@tensor C[x, y, b, a, z]:=B[y, z, a, σ] * A[x, b, σ]
@tensor C[x, y, b, a, z] := B[y, z, a, σ] * A[x, b, σ]
C = reshape(C, size(C, 1) * size(C, 2), size(C, 3) * size(C, 4), size(C, 5))
return C
end
Expand Down
2 changes: 1 addition & 1 deletion src/gauges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function update_qr!(ψ::QMps{T}, AT::AbstractArray{T,3}, i::Site) where {T<:Real
QT, RT = qr_fact(ATR)
RT ./= maximum(abs.(RT))
# @cast AT[x, σ, y] := QT[(x, σ), y] (σ ∈ 1:size(AT, 2))
AT = reshape(QT, size(QT, 1) ÷ size(AT, 2), size(AT, 2), size(QT, 2))
AT = reshape(QT, size(QT, 1) ÷ size(AT, 2), size(AT, 2), size(QT, 2))
ψ[i] = AT
RT
end
Expand Down
2 changes: 1 addition & 1 deletion src/mps/canonise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function _left_sweep!(
R, Q = rq_fact(M, Dcut, tolS; toGPU = ψ.onGPU, kwargs...)
R ./= maximum(abs.(R))
# @cast B[x, σ, y] := Q[x, (σ, y)] (σ ∈ 1:size(B, 2))
B = reshape(Q, size(Q, 1), size(B, 2), size(Q, 2) ÷ size(B, 2))
B = reshape(Q, size(Q, 1), size(B, 2), size(Q, 2) ÷ size(B, 2))

ψ[i] = permutedims(B, (1, 3, 2))
end
Expand Down
14 changes: 10 additions & 4 deletions src/mps/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ end

function is_left_normalized::QMps, ::Val{true})
all(
eye(eltype(ψ), size(A, 2); toGPU = true)
@tensor(Id[x, y] := A[α, x, σ] * A[α, y, σ]; backend=cuTENSOR, allocator=cuTENSOR) for A values.tensors) # TODO: split the line
eye(eltype(ψ), size(A, 2); toGPU = true) @tensor(
Id[x, y] := A[α, x, σ] * A[α, y, σ];
backend = cuTENSOR,
allocator = cuTENSOR
) for A values.tensors) # TODO: split the line
)
end

Expand All @@ -59,8 +62,11 @@ end

function is_right_normalized::QMps, ::Val{true})
all(
eye(eltype(ψ), size(B, 1); toGPU = true)
@tensor(Id[x, y] := B[x, α, σ] * B[y, α, σ]; backend=cuTENSOR, allocator=cuTENSOR) for B values.tensors) # TODO: split the line
eye(eltype(ψ), size(B, 1); toGPU = true) @tensor(
Id[x, y] := B[x, α, σ] * B[y, α, σ];
backend = cuTENSOR,
allocator = cuTENSOR
) for B values.tensors) # TODO: split the line
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/zipper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function zipper(
CCC = reshape(CCC, size(CCC, 1), size(CCC, 2) ÷ s1, s1)
C = permutedims(CCC, (2, 1, 3))
# @cast V[x, y, z] := V[x, (y, z)] (z ∈ 1:s2)
V = reshape(V, size(V, 1), size(V, 2) ÷ s2, s2)
V = reshape(V, size(V, 1), size(V, 2) ÷ s2, s2)
out[i] = V
else
L = onGPU ? CUDA.ones(R, 1, 1, 1) : ones(R, 1, 1, 1)
Expand Down

0 comments on commit 1048294

Please sign in to comment.