Skip to content

Commit

Permalink
Fix order stability of elements in arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Nov 10, 2023
1 parent 80181a2 commit a2079e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Return a list of the `Tensor`s in the [`TensorNetwork`](@ref).
- As the tensors of a [`TensorNetwork`](@ref) are stored as keys of the `.tensormap` dictionary and it uses `objectid` as hash, order is not stable so it sorts for repeated evaluations.
"""
tensors(tn::AbstractTensorNetwork) = sort!(collect(keys(tn.tensormap)), by = inds)
arrays(tn::AbstractTensorNetwork) = parent.(keys(tn.tensormap))
arrays(tn::AbstractTensorNetwork) = parent.(tensors(tn))

Base.collect(tn::AbstractTensorNetwork) = tensors(tn)

Expand Down

0 comments on commit a2079e6

Please sign in to comment.