Skip to content

Commit

Permalink
fix (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu authored Dec 11, 2024
1 parent 855d98a commit 20ef83b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/complexity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _timespacereadwrite_complexity(ei::NestedEinsum, log2_sizes::Dict{L,VT}
end
tc2, sc2, rw2 = _timespacereadwrite_complexity(getixsv(ei.eins), getiyv(ei.eins), log2_sizes)
tc = log2sumexp2([tcs..., tc2])
sc = max(reduce(max, scs), sc2)
sc = max(reduce(max, scs, init=zero(VT)), sc2)
rw = log2sumexp2([rws..., rw2])
return tc, sc, rw
end
Expand Down
10 changes: 9 additions & 1 deletion test/Core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ using Test
new_eincode = OMEinsum.decorate(closed_code)
@test eincode(tensors...) new_eincode(tensors...)
end
end
end

@testset "contraction complexity for empty tensor network" begin
code = OMEinsumContractionOrders.EinCode(Vector{Char}[], Char[])
@test contraction_complexity(code, Dict{Char, Int}()).sc == 0

code = OMEinsumContractionOrders.NestedEinsum(OMEinsumContractionOrders.NestedEinsum{Char}[], OMEinsumContractionOrders.EinCode(Vector{Char}[], Char[]))
@test contraction_complexity(code, Dict{Char, Int}()).sc == 0
end

0 comments on commit 20ef83b

Please sign in to comment.