qiskit_qec.linear.make_commute_hyper

make_commute_hyper(a, x, z, arange=None, xrange=None, zrange=None)[source]

Makes an element(s) commute with hyperbolic pair(s)

Let a = [a_0,…,a_(k-1)] where a_i are GF(2) symplectic vectors. Let x = [x_0,…,x_(l-1)] and z =[z_0,…,z_(l-1)] where x_i and z_i are GF(2) symplectic vectors such that (x_i,z_i) are hyerbolic pairs from the hyperbolic a basis <x_0,…,x_(l-1),z_0,…,x_(l-1)>. It is assumed that {a_0,…,a_(k-1),x_0,…,x_(l-1),z_0,…,x_(l-1)} is an independent set of symplectic vectors.

This method returns a set of vectors b = [b_0,…,b_(k-1)] such that

1) b_0, …, b_(k-1) each have zero symplectic product with each of the hyperbolic vectors x_0,…,x_(l-1),z_0,…,x_(l-1) 2) span(b_i, x_j,z_j) = span(a_i, x_j,z_j) for i=0,..,k-1 and j=0,…,l-1

If the symplectic vectors are considered as Pauli operators then the method returns a set of operators [op_(b_0),…,op_(b_(k-1))] such that

1) op_(b_0), …, op_(b_(k-1)) each commute with the each of the hyperbolic operators op_(x_0),…,op_(x_(l-1)),op_(z_0),…,op_(x_(l-1)) 2) <op_(b_i), op_(x_j),op_(z_j)> = <op_(a_i), op_(x_j),op_(z_j)> for each i=0,…,k-1 and j=0,…,l-1

Parameters:
  • a (ndarray) – Input GF(2) symplectic vectors

  • x (ndarray) – GF(2) hyperbolic pair vector

  • z (ndarray) – GF(2) hyperbolic pair vector

  • arange (optional) – range of indices from a to make commute. Defaults to None.

  • xrange (optional) – range of indices from x to use. Defaults to None.

  • zrange (optional) – range of indices from z to use. Defaults to None.

Raises:
  • QiskitError – Input matrices/vectors must bf GF(2) symplectic matrices/vectors

  • QiskitError – Input range is not iterable”)

  • QiskitError – Input matrices/vectors must have the same number of columns/length

Return type:

ndarray

Returns:

GF(2) symplectic vectors that commute with the given hyperbolic pairs

Examples

>>> a = numpy.array([1,1,1,0,0,0],dtype=numpy.bool_)
>>> x = numpy.array([0,0,1,0,0,0],dtype=numpy.bool_)
>>> z = numpy.array([0,0,0,0,0,1],dtype=numpy.bool_)
>>> a = make_commute_hyper(a, x, z)
>>> a.astype(int)
array([1, 1, 0, 0, 0, 0])
>>> a = numpy.array([1,1,1,0,0,0,0,0], dtype=numpy.bool_)
>>> x = numpy.array([[0,1,0,0,0,0,0,0],[0,0,1,0,0,0,0,0]], dtype=numpy.bool_)
>>> z = numpy.array([[0,0,0,0,0,1,0,0],[0,0,0,0,0,0,1,0]], dtype=numpy.bool_)
>>> xrange = [0,1]
>>> zrange = [0,1]
>>> a = make_commute_hyper(a, x, z, xrange = xrange, zrange=zrange)
>>> a.astype(int)
array([1, 0, 0, 0, 0, 0, 0, 0])
>>> a = numpy.array([[1,1,1,0,0,0,0,0],[0,1,1,0,0,0,0,0]], dtype=numpy.bool_) # X1X2X3, X2X3
>>> x = numpy.array([0,1,0,0,0,0,0,0], dtype=numpy.bool_) # X2
>>> z = numpy.array([0,0,0,0,0,1,0,0], dtype=numpy.bool_) # Z2
>>> arange = [0,1]
>>> a = make_commute_hyper(a, x, z, arange)
>>> a.astype(int)
array([[1, 0, 1, 0, 0, 0, 0, 0],
       [0, 0, 1, 0, 0, 0, 0, 0]])
>>> a = numpy.array([[1,1,1,0,0,0,0,0],[0,1,1,1,0,0,0,0]], dtype=numpy.bool_)
>>> x = numpy.array([[0,1,0,0,0,0,0,0],[0,0,1,0,0,0,0,0]], dtype=numpy.bool_)
>>> z = numpy.array([[0,0,0,0,0,1,0,0], [0,0,0,0,0,0,1,0]], dtype=numpy.bool_)
>>> arange = [0,1]
>>> a = make_commute_hyper(a, x, z, arange)
>>> a.astype(int)
array([[1, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 1, 0, 0, 0, 0]])

See Also: _make_commute_hyper