Skip to content

Commit

Permalink
improved clip! a tiny bit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmayhall-vt committed Sep 27, 2023
1 parent c27538f commit ffe3f1a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/type_PauliSum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,7 @@ end
Delete Pauli's with coeffs smaller than thresh
"""
function clip!(ps::PauliSum; thresh=1e-16)
to_delete = []
for (op,coeff) in ps.ops
if abs(coeff) < thresh
push!(to_delete, op)
end
end
for k in to_delete
delete!(ps.ops, k)
end
filter!(p->abs(p.second) > thresh, ps.ops)
end

"""
Expand Down

0 comments on commit ffe3f1a

Please sign in to comment.