Ejemplo n.º 1
0
 def test_swap_qubits(self, sparse):
     a = qu.up() & qu.down()
     s = qu.swap(2, sparse=sparse)
     assert_allclose(s @ a, qu.down() & qu.up())
Ejemplo n.º 2
0
 def test_swap_higher_dim(self, sparse):
     a = qu.rand_ket(9)
     s = qu.swap(3, sparse=sparse)
     assert_allclose(s @ a, a.reshape([3, 3]).T.reshape([9, 1]))
Ejemplo n.º 3
0
 def test_swap_qubits(self, sparse):
     a = up() & down()
     s = swap(2, sparse=sparse)
     assert_allclose(s @ a, down() & up())