Skip to content

Commit

Permalink
Improve I/O for orders
Browse files Browse the repository at this point in the history
  • Loading branch information
dcerkoney committed Oct 10, 2023
1 parent 664434f commit 9af118e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/computational_graph/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ function short(factor, ignore=nothing)
end
end

function short_orders(orders)
orders_no_trailing_zeros = ""
idx_last_set = findlast(x -> x != 0, orders)
if isnothing(idx_last_set) == false
orders_no_trailing_zeros *= string(orders[1:idx_last_set])
end
return orders_no_trailing_zeros
end

function _stringrep(graph::AbstractGraph, color=true)
namestr = isempty(graph.name) ? "" : "-$(graph.name)"
idstr = "$(graph.id)$namestr"
Expand All @@ -25,7 +34,7 @@ function _stringrep(graph::AbstractGraph, color=true)
end
fstr = short(graph.factor, one(graph.factor))
wstr = short(graph.weight)
ostr = string(orders(graph))
ostr = short_orders(orders(graph))
# =$(node.weight*(2π)^(3*node.id.para.innerLoopNum))

if length(graph.subgraphs) == 0
Expand Down

0 comments on commit 9af118e

Please sign in to comment.