def test_pauli_states(): sx, sz = SigmaX(), SigmaZ() up = SigmaZKet(0) down = SigmaZKet(1) assert qapply(sx * up) == down assert qapply(sx * down) == up assert qapply(sz * up) == up assert qapply(sz * down) == -down up = SigmaZBra(0) down = SigmaZBra(1) assert qapply(up * sx, dagger=True) == down assert qapply(down * sx, dagger=True) == up assert qapply(up * sz, dagger=True) == up assert qapply(down * sz, dagger=True) == -down assert Dagger(SigmaZKet(0)) == SigmaZBra(0) assert Dagger(SigmaZBra(1)) == SigmaZKet(1)
def test_pauli_operators_adjoint_with_labels(): assert Dagger(sx1) == sx1 assert Dagger(sy1) == sy1 assert Dagger(sz1) == sz1 assert Dagger(sx1) != sx2 assert Dagger(sy1) != sy2 assert Dagger(sz1) != sz2
def operator_lindblad_dissipator(a, rho): """ Lindblad operator dissipator """ return (Dagger(a) * rho * a - rho * Dagger(a) * a / 2 - Dagger(a) * a * rho / 2)
def lindblad_dissipator(a, rho): """ Lindblad dissipator """ return (a * rho * Dagger(a) - rho * Dagger(a) * a / 2 - Dagger(a) * a * rho / 2)
def test_pauli_operators_adjoint(): assert Dagger(sx) == sx assert Dagger(sy) == sy assert Dagger(sz) == sz