Skip to content

Commit

Permalink
Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Jan 1, 2024
1 parent ba6e558 commit ed20ce0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/planar/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function planarparser(planarexpr, kwargs...)

# braiding tensors need to be instantiated before kwargs are processed
push!(parser.preprocessors, _construct_braidingtensors)

for (name, val) in kwargs
if name == :order
isexpr(val, :tuple) ||
Expand Down Expand Up @@ -62,7 +62,7 @@ function planarparser(planarexpr, kwargs...)
throw(ArgumentError("Unknown keyword argument `name`."))
end
end

treebuilder = parser.contractiontreebuilder
treesorter = parser.contractiontreesorter
costcheck = parser.contractioncostcheck
Expand Down
3 changes: 2 additions & 1 deletion test/ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ Vlist = ((ℂ^2, (ℂ^3)', ℂ^3, ℂ^2, (ℂ^2)'),
T <: Complex && remove_svdgauge_depence!(ΔU, ΔV, U, S, V)
test_rrule(tsvd, C; atol, output_tangent=(ΔU, ΔS, ΔV, 0.0))

c, = TensorKit.MatrixAlgebra._argmax(x -> sqrt(dim(x[1])) * maximum(diag(x[2])), blocks(S))
c, = TensorKit.MatrixAlgebra._argmax(x -> sqrt(dim(x[1])) * maximum(diag(x[2])),
blocks(S))
U, S, V, ϵ = tsvd(C; trunc=truncdim(2 * dim(c)))
ΔU = TensorMap(randn, scalartype(U), space(U))
ΔS = TensorMap(randn, scalartype(S), space(S))
Expand Down
12 changes: 6 additions & 6 deletions test/planar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,29 @@ end

@testset "@planar" verbose = true begin
T = ComplexF64

@testset "contractcheck" begin
V =^2
A = TensorMap(rand, T, V V V)
B = TensorMap(rand, T, V V V')
@tensor C1[i j; k l] := A[i j; m] * B[k l; m]
@tensor contractcheck=true C2[i j; k l] := A[i j; m] * B[k l; m]
@tensor contractcheck = true C2[i j; k l] := A[i j; m] * B[k l; m]
@test C1 C2
B2 = TensorMap(rand, T, V V V) # wrong duality for third space
@test_throws SpaceMismatch("incompatible spaces for m: $V$(V')") begin
@tensor contractcheck = true C3[i j; k l] := A[i j; m] * B2[k l; m]
end

A = TensorMap(rand, T, V V V)
B = TensorMap(rand, T, V V V)
@planar C1[i; j] := A[i; k l] * τ[k l; m n] * B[m n; j]
@planar contractcheck=true C2[i; j] := A[i; k l] * τ[k l; m n] * B[m n; j]
@planar contractcheck = true C2[i; j] := A[i; k l] * τ[k l; m n] * B[m n; j]
@test C1 C2
@test_throws SpaceMismatch("incompatible spaces for l: $V$(V')") begin
@planar contractcheck=true C3[i; j] := A[i; k l] * τ[k l; m n] * B[n j; m]
@planar contractcheck = true C3[i; j] := A[i; k l] * τ[k l; m n] * B[n j; m]
end
end

@testset "MPS networks" begin
P =^2
Vmps =^12
Expand Down

0 comments on commit ed20ce0

Please sign in to comment.