qiskit_qec.linear.symplectic_gram_schmidt

symplectic_gram_schmidt(a, x=None, z=None)[source]

Applies the sympletic Gram-Schmidt process to the input matrix

Apply the symplectic GramSchmidt process to the input symplectic matrix. Resulting hyperbolic pairs are added to x and z arrays. Elements of the center will be added to the center array.

Parameters:
  • a (ndarray) – Symplectic matrix

  • x (optional) – GF(2) Symplectic matrices representing hyperbolic pairs to

  • z (optional) – GF(2) Symplectic matrices representing hyperbolic pairs to

  • None. (build upon. Default is)

Raises:
  • QiskitError Input matric not a GF(2) symplectic matrix

  • QiskitError – Input hyperbolic array x is not a GF(2) sympletic matrix

  • QiskitError – Input hyperbolic array z is not a GF(2) sympletic matrix

  • QiskitError – Input hyperbolic arrays have different dimensions

  • QiskitError – Input hyperbolic matrices do not represent a hyperbolic basis

Return type:

Tuple[ndarray, ndarray, ndarray]

Returns:

Center array and hyperbolic pairs split accross x and z

Examples

>>> a = numpy.array([[0,1,0,0,1,0,1,0],
                  [0,0,0,0,1,1,0,1],
                  [1,1,1,0,0,1,0,0],
                  [1,1,0,1,0,0,0,0]], dtype=numpy.bool_)
>>> center_, x, z = symplectic_gram_schmidt(a)
>>> center_.astype(int)
array([[1, 1, 1, 0, 1, 0, 0, 1],
       [1, 0, 0, 1, 0, 1, 1, 1]])
>>> x.astype(int)
array([[0, 1, 0, 0, 1, 0, 1, 0]])
>>> z.astype(int)
array([[0, 0, 0, 0, 1, 1, 0, 1]])

Also See: _symplectic_gram_schmidt

TODO: Add an example that shows using the optional x and z arrays