Skip to content

Commit

Permalink
Merge pull request #152 from numericalEFT/computgraph_daniel
Browse files Browse the repository at this point in the history
Bugfix & cleanup exports
  • Loading branch information
dcerkoney authored Oct 30, 2023
2 parents 050b8a2 + e3a978f commit 12f821d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/FeynmanDiagram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export optimize!, optimize, merge_all_chains!, merge_all_linear_combinations!, r
include("TaylorSeries/TaylorSeries.jl")
using .Taylor
export Taylor
export TaylorSeries, set_variables, taylor_factorial, getcoeff


include("backend/compiler.jl")
Expand Down
10 changes: 5 additions & 5 deletions src/backend/static.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ function to_static(::Type{ComputationalGraphs.Prod}, subgraphs::Vector{Graph{F,W
end
end

function _to_static(::Type{ComputationalGraphs.Power{N}}, subgraphs::Vector{Graph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W}
function to_static(::Type{ComputationalGraphs.Power{N}}, subgraphs::Vector{Graph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W}
factor_str = subgraph_factors[1] == 1 ? "" : " * $(subgraph_factors[1])"
return "((g$(subgraphs[1].id))^$N$factor_str)"
end

function _to_static(::Type{ComputationalGraphs.Sum}, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {F,W}
function to_static(::Type{ComputationalGraphs.Sum}, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {F,W}
if length(subgraphs) == 1
factor_str = subgraph_factors[1] == 1 ? "" : " * $(subgraph_factors[1])"
return "(g$(subgraphs[1].id)$factor_str)"
Expand All @@ -56,7 +56,7 @@ function to_static(::Type{ComputationalGraphs.Prod}, subgraphs::Vector{FeynmanGr
end
end

function _to_static(::Type{ComputationalGraphs.Power{N}}, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W}
function to_static(::Type{ComputationalGraphs.Power{N}}, subgraphs::Vector{FeynmanGraph{F,W}}, subgraph_factors::Vector{F}) where {N,F,W}
factor_str = subgraph_factors[1] == 1 ? "" : " * $(subgraph_factors[1])"
return "((g$(subgraphs[1].id))^$N$factor_str)"
end
Expand Down Expand Up @@ -91,7 +91,7 @@ function to_julia_str(graphs::AbstractVector{<:AbstractGraph}; root::AbstractVec
else
g_id in inds_visitednode && continue
factor_str = factor(g) == 1 ? "" : " * $(factor(g))"
body *= " $target = $(_to_static(operator(g), subgraphs(g), subgraph_factors(g)))$factor_str\n "
body *= " $target = $(to_static(operator(g), subgraphs(g), subgraph_factors(g)))$factor_str\n "
push!(inds_visitednode, g_id)
end
if isroot
Expand Down Expand Up @@ -139,7 +139,7 @@ function to_julia_str(graphs::AbstractVector{<:AbstractGraph}, leafMap::Dict{Int
else
g_id in inds_visitednode && continue
factor_str = factor(g) == 1 ? "" : " * $(factor(g))"
body *= " $target = $(_to_static(operator(g), subgraphs(g), subgraph_factors(g)))$factor_str\n "
body *= " $target = $(to_static(operator(g), subgraphs(g), subgraph_factors(g)))$factor_str\n "
push!(inds_visitednode, g_id)
end
if isroot
Expand Down
2 changes: 1 addition & 1 deletion test/taylor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using FeynmanDiagram: Taylor as Taylor

@testset verbose = true "TaylorSeries" begin
using FeynmanDiagram.Taylor:
getcoeff
getcoeff, set_variables, taylor_factorial
a, b, c, d, e = set_variables("a b c d e", order=3)
F1 = (a + b) * (a + b) * (a + b)
print("$(F1)")
Expand Down

0 comments on commit 12f821d

Please sign in to comment.