diff --git a/docs/src/graph.md b/docs/src/graph.md index bff3a30..9bb12a6 100644 --- a/docs/src/graph.md +++ b/docs/src/graph.md @@ -1,4 +1,3 @@ - # Graphs and their manipulation @@ -18,7 +17,6 @@ In general a graph is composed of linear combinations ``C = \alpha A + \beta B`` add_lincomb! add_mult! add_ldiv! -add_sum! ``` The graph can have multiple outputs and the behavior controlled. diff --git a/src/compgraph_struct.jl b/src/compgraph_struct.jl index e8784e5..1d3849e 100644 --- a/src/compgraph_struct.jl +++ b/src/compgraph_struct.jl @@ -12,7 +12,6 @@ export get_topo_order export add_mult! export add_lincomb! export add_ldiv! -export add_sum! export add_output! export del_output! export clear_outputs! @@ -111,7 +110,6 @@ end The operation `α1*p1+α2*p2` is added to the graph. The result is stored in node `node`. -See also [`add_sum!`](@ref). """ function add_lincomb!(graph, node, α1, p1, α2, p2) check_node_name_legality(graph, node) @@ -243,40 +241,6 @@ function rename_node!(graph, src, dest, cref = Vector()) return nothing end -""" - cref=add_sum!(graph,node,c,nodelist,base_name=node) - -Adds a linear combination of more than two nodes, given in `nodelist::Vector`, -with coefficients given in `c`. The `base_name` is temporary variables for the -summing. The sum is stored in `node`. - -Returns `cref` list with references. -""" -function add_sum!(graph, node, c, nodelist, base_name = node) - if size(nodelist, 1) == 1 - error("Summing one element not allowed.") - elseif (size(nodelist, 1) == 2) - # Direct call to lincomb if we sum two nodes - add_lincomb!(graph, node, c[1], nodelist[1], c[2], nodelist[2]) - return [(node, 1), (node, 2)] - end - - cref = Vector{Tuple{Symbol,Int}}() - key = Symbol("$(base_name)2") - add_lincomb!(graph, key, c[1], nodelist[1], c[2], nodelist[2]) - push!(cref, (key, 1)) - push!(cref, (key, 2)) - for k = 3:size(nodelist, 1) - prev_key = key - key = Symbol("$(base_name)$k") - add_lincomb!(graph, key, 1, prev_key, c[k], nodelist[k]) - push!(cref, (key, 2)) - end - # Rename the final sum as the target node - rename_node!(graph, key, node, cref) - return cref -end - """ del_node!(graph,node)