Skip to content

Commit

Permalink
add test suite 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Nov 17, 2024
1 parent 7e9b300 commit 548c8cf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_nonclifford_quantumoptics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ end
@test norm_qo_state_after_proj norm_result2 || norm_qo_state_after_proj norm_result1
end
end

for _ in 1:100
for n in 1:1
stab = random_stabilizer(n)
genstab = GeneralizedStabilizer(stab)
pauli = random_pauli(n)
apply!(genstab, pcT)
qo_state_after_proj, result1, result2 = _projrand(genstab,pauli)
# Normalize to ensure consistent comparison of the projected state
norm_qo_state_after_proj = iszero(qo_state_after_proj) ? qo_state_after_proj : qo_state_after_proj/tr(qo_state_after_proj)
norm_result1 = iszero(result1) ? result1 : result1/tr(result1)
norm_result2 = iszero(result2) ? result2 : result2/tr(result2)
@test projectrand!(genstab, pauli)[1] |> invsparsity <= genstab |> invsparsity # Note: Λ(χ′) ≤ Λ(χ).
@test norm_qo_state_after_proj norm_result2 || norm_qo_state_after_proj norm_result1
end
end
end

# TODO Add more tests...

0 comments on commit 548c8cf

Please sign in to comment.