Skip to content

Commit

Permalink
Sort output of sites (#185)
Browse files Browse the repository at this point in the history
* sort output of sites(::Quantum) so sites are in order

* formatting

* use sort! to save nanobyte allocations
  • Loading branch information
starsfordummies authored and mofeing committed Sep 4, 2024
1 parent b64019b commit 6208d5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Quantum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Returns the sites of a [`Quantum`](@ref) Tensor Network.
"""
function sites(tn::Quantum; kwargs...)
if isempty(kwargs)
collect(keys(tn.sites))
sort!(collect(keys(tn.sites)))
elseif keys(kwargs) === (:at,)
findfirst(i -> i === kwargs[:at], tn.sites)
else
Expand Down

0 comments on commit 6208d5b

Please sign in to comment.