def test_QubitBra(): assert Qubit(0).dual_class() == QubitBra assert QubitBra(0).dual_class() == Qubit assert represent(Qubit(1,1,0), nqubits=3).H ==\ represent(QubitBra(1,1,0), nqubits=3) assert Qubit(0,1)._eval_innerproduct_QubitBra(QubitBra(1,0)) == Integer(0) assert Qubit(0,1)._eval_innerproduct_QubitBra(QubitBra(0,1)) == Integer(1)
def test_QubitBra(): qb = Qubit(0) qb_bra = QubitBra(0) assert qb.dual_class() == QubitBra assert qb_bra.dual_class() == Qubit qb = Qubit(1, 1, 0) qb_bra = QubitBra(1, 1, 0) assert represent(qb, nqubits=3).H == represent(qb_bra, nqubits=3) qb = Qubit(0, 1) qb_bra = QubitBra(1,0) assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(0) qb_bra = QubitBra(0, 1) assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(1)
def test_issue_5923(): # most of the issue regarding sympification of args has been handled # and is tested internally by the use of args_cnc through the quantum # module, but the following is a test from the issue that used to raise. assert TensorProduct(1, Qubit("1") * Qubit("1").dual) == TensorProduct( 1, OuterProduct(Qubit(1), QubitBra(1)))
def test_QubitBra(): qb = Qubit(0) qb_bra = QubitBra(0) assert qb.dual_class() == QubitBra assert qb_bra.dual_class() == Qubit qb = Qubit(1, 1, 0) qb_bra = QubitBra(1, 1, 0) assert represent(qb, nqubits=3).H == represent(qb_bra, nqubits=3) qb = Qubit(0, 1) qb_bra = QubitBra(1, 0) assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(0) qb_bra = QubitBra(0, 1) assert qb._eval_innerproduct_QubitBra(qb_bra) == Integer(1)
def test_sympy__physics__quantum__qubit__QubitBra(): from sympy.physics.quantum.qubit import QubitBra assert _test_args(QubitBra('1', 0))
from sympy.physics.quantum.qubit import QubitBra from sympy.physics.quantum.dagger import Dagger sympy.init_printing() # In[5]: print('sympy version : ', sympy.__version__) # 1量子ビットをブラケット記号を用いて指定します。 # In[6]: # 1量子ビット q0 = Qubit('0') q1 = Qubit('1') p0 = QubitBra('1') p1 = QubitBra('1') # In[7]: q0 # In[8]: q1 # In[9]: p0 # In[10]: