diff --git a/Project.toml b/Project.toml index ac2dac9..f527669 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OMEinsum" uuid = "ebe7aa44-baf0-506c-a96f-8464559b3922" authors = ["Andreas Peter "] -version = "0.8.3" +version = "0.8.4" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" @@ -11,6 +11,7 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" +SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" @@ -49,4 +50,4 @@ TropicalNumbers = "b3a74e9c-7526-4576-a4eb-79c0d4c32334" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Test", "CUDA", "Documenter", "LinearAlgebra", "ProgressMeter", "SymEngine", "Random", "Zygote", "DoubleFloats", "TropicalNumbers", "ForwardDiff", "Polynomials", "LuxorGraphPlot"] +test = ["Test", "CUDA", "Documenter", "LinearAlgebra", "LuxorGraphPlot", "ProgressMeter", "SymEngine", "Random", "Zygote", "DoubleFloats", "TropicalNumbers", "ForwardDiff", "Polynomials"] diff --git a/src/OMEinsum.jl b/src/OMEinsum.jl index 6c40e86..dac81d8 100644 --- a/src/OMEinsum.jl +++ b/src/OMEinsum.jl @@ -17,7 +17,7 @@ export cost_and_gradient # re-export the functions in OMEinsumContractionOrders export CodeOptimizer, CodeSimplifier, - KaHyParBipartite, GreedyMethod, TreeSA, SABipartite, + KaHyParBipartite, GreedyMethod, TreeSA, SABipartite, ExactTreewidth, MinSpaceDiff, MinSpaceOut, MergeGreedy, MergeVectors, uniformsize, diff --git a/src/einsum.jl b/src/einsum.jl index 5cd598a..b943639 100644 --- a/src/einsum.jl +++ b/src/einsum.jl @@ -22,7 +22,7 @@ true ``` " function einsum(code::AbstractEinsum, @nospecialize(xs::Tuple), size_dict::Dict=get_size_dict!(getixs(code), xs, Dict{labeltype(code),Int}())) - y = get_output_array(xs, map(y -> size_dict[y], getiyv(code)); fillzero=false) + y = get_output_array(xs, map(y -> size_dict[y], getiyv(code)); fillzero=true) einsum!(code, xs, y, true, false, size_dict) end diff --git a/test/contractionorder.jl b/test/contractionorder.jl index 2d07dba..b8c6b0a 100644 --- a/test/contractionorder.jl +++ b/test/contractionorder.jl @@ -22,6 +22,10 @@ using Test, Random optcode3 = optimize_code(eincode3, size_dict, GreedyMethod()) tc, sc = contraction_complexity(optcode3, edge_sizes) @test 16 <= tc <= log2(exp2(10)+exp2(16)+exp2(15)+exp2(9)+1e-8) + + optcode4 = optimize_code(eincode3, size_dict, ExactTreewidth()) + tc, sc = contraction_complexity(optcode4, edge_sizes) + @test 16 <= tc <= log2(exp2(10)+exp2(16)+exp2(15)+exp2(9)+1e-8) end @testset "fullerene" begin diff --git a/test/einsum.jl b/test/einsum.jl index 628e802..7999d54 100644 --- a/test/einsum.jl +++ b/test/einsum.jl @@ -317,3 +317,7 @@ Base.promote_rule(::Type{Bool}, ::Type{Basic}) = Basic ta = loop_einsum(EinCode(((1,2,3,4), (2,3)), (1,4)), (t,a), size_dict) @test einsum(EinCode(((1,2,3,4), (2,3)), (1,4)), (t,a), size_dict) ≈ ta end + +@testset "symbolic" begin + @test ein"ij->ijij"([1 1; 1 exp(im*Basic(π)/2)]) == [1 0; 0 0;;; 0 0; 1 0;;;; 0 1; 0 0;;; 0 0; 0 exp(im*Basic(π)/2)] +end