Skip to content

Commit

Permalink
Replace refs to add_sum! with refs to add_lincomb! (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfasi committed Feb 2, 2024
1 parent 4d913d4 commit 5d6d644
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/generators/bigraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ function graph_bigraph(graph0)

if length(coeffs)>2
# Overwrite it!
add_sum!(graph,node, coeffs,parents,
unused_base_name(graph,node))
add_lincomb!(graph,node, coeffs, parents)
elseif (length(coeffs)==1) # Expand by a trivial multiplication
graph.parents[node]=[:I;parents[1]];
graph.coeffs[node]=[0;coeffs[1]];
Expand Down
12 changes: 6 additions & 6 deletions src/generators/exp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ function graph_exp_native_jl_low(C, input)
end

a = view(C, 1:2:n-1)
cref[1:s+1] = add_sum!(graph, :V, a, evenmon, :V)
cref[1:s+1] = add_lincomb!(graph, :V, a, evenmon)

a = view(C, 2:2:n)
cref[s+2:n] = add_sum!(graph, :Ua, a, evenmon, :Ua)
cref[s+2:n] = add_lincomb!(graph, :Ua, a, evenmon)
add_mult!(graph, :U, :Ua, input)

add_lincomb!(graph, :X, 1.0, :V, 1.0, :U)
Expand Down Expand Up @@ -162,12 +162,12 @@ function graph_exp_native_jl_high(CC, s, input)

# Ub3= CC[14].*A6 .+ CC[12].*A4 .+ CC[10].*A2
a = view(CC, 10:2:14)
cref[1:3] = add_sum!(graph, :Ub3, a, [:A2, :A4, :A6], :Ub)
cref[1:3] = add_lincomb!(graph, :Ub3, a, [:A2, :A4, :A6])
add_mult!(graph, :Ub, :Ub3, :A6)

# Ua = CC[8].*A6 .+ CC[6].*A4 .+ CC[4].*A2 .+ CC[2].*Inn
a = view(CC, 2:2:8)
cref[4:7] = add_sum!(graph, :Ua, a, [:I, :A2, :A4, :A6], :Ua)
cref[4:7] = add_lincomb!(graph, :Ua, a, [:I, :A2, :A4, :A6])

add_lincomb!(graph, :Uc, 1.0, :Ub, 1.0, :Ua)
add_mult!(graph, :U, C, :Uc)
Expand All @@ -177,12 +177,12 @@ function graph_exp_native_jl_high(CC, s, input)

# Vb3= CC[13].*A6 .+ CC[11].*A4 .+ CC[9].*A2
a = view(CC, 9:2:13)
cref[8:10] = add_sum!(graph, :Vb3, a, [:A2, :A4, :A6], :Vb)
cref[8:10] = add_lincomb!(graph, :Vb3, a, [:A2, :A4, :A6])
add_mult!(graph, :Vb, :Vb3, :A6)

# Va = CC[7].*A6 .+ CC[5].*A4 .+ CC[3].*A2 .+ CC[1].*Inn
a = view(CC, 1:2:7)
cref[11:14] = add_sum!(graph, :Va, a, [:I, :A2, :A4, :A6], :Va)
cref[11:14] = add_lincomb!(graph, :Va, a, [:I, :A2, :A4, :A6])

add_lincomb!(graph, :V, 1.0, :Vb, 1.0, :Va)

Expand Down
2 changes: 1 addition & 1 deletion src/generators/monomial_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function graph_monomial(a; input = :A, polyname = :P)
end

# Sum up the polynomial
cref[:] .= add_sum!(graph, outkey, a, nodelist, polyname)
cref[:] .= add_lincomb!(graph, outkey, a, nodelist)

add_output!(graph, outkey)
return (graph, cref)
Expand Down

0 comments on commit 5d6d644

Please sign in to comment.