Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate on basic type #174

Merged
merged 3 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OMEinsum"
uuid = "ebe7aa44-baf0-506c-a96f-8464559b3922"
authors = ["Andreas Peter <[email protected]>"]
version = "0.8.3"
version = "0.8.4"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -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"

Expand Down Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion src/OMEinsum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/einsum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions test/contractionorder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/einsum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading