Skip to content

Commit 545c9b9

Browse files
Update ext/QuantumToolboxMakieExt.jl
Co-authored-by: Alberto Mercurio <[email protected]>
1 parent eaf01a5 commit 545c9b9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

ext/QuantumToolboxMakieExt.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,13 @@ Add one or more quantum states to the Bloch sphere visualization by converting t
424424
425425
"""
426426
function QuantumToolbox.add_states!(b::Bloch, states::Vector{<:QuantumObject})
427-
vecs = Vector{Vector{Float64}}()
428-
for state in states
429-
vec = if isket(state) || isbra(state)
430-
_state_to_bloch(state)
431-
else
432-
_dm_to_bloch(state)
433-
end
434-
push!(vecs, vec)
427+
vecs = map(states) do state
428+
if isket(state) || isbra(state)
429+
return _state_to_bloch(state)
430+
else
431+
return _dm_to_bloch(state)
435432
end
433+
end
436434
return add_vectors!(b, vecs)
437435
end
438436

0 commit comments

Comments
 (0)