qiskit_qec.linear.locate_hyper_partner

locate_hyper_partner(matrix, vector)[source]

Locate a hyperbolic/noncommutative parter

Let [m_0,…,m_(k-1)] be the input search matrix and v be the input vector. This method search through the vectors m_i to locate a (hyperbolic) vector that has a symplectic product with v of 1. If a hyperbolic partner ‘av’ is found then it and its index in the search matrix is turned as a tuple (av, index). If no such vector exists then None value is returned.

Parameters:
  • matrix (ndarray) – GF(2) symplectic matrix (for search)

  • vector (ndarray) – GF(2) symplectic vector to find a hyperbolic pair for

Raises:
  • QiskitError – Input matrix must be a GF(2) symplectic matrix and input vector must be a GF(2) symplectic vector

  • QiskitError – Input {matrix} must be a 2 dimensional array

  • QiskitError – Input {vector} must be a 1 dimensional array

  • QiskitError – Input matrix and vector must have the same number of columns/length

Return type:

Optional[Tuple[ndarray, int]]

Returns:

Tuple of the found hyperbolic partner (av) and its index in the

search matrix. ‘None’ if no hyperbolic partner is found.

Examples

>>> matrix = numpy.array([[1,0,1,0,0,0,0,0],[0,1,1,0,0,0,0,0]], dtype=numpy.bool_)
>>> vector = numpy.array([0,0,0,0,0,1,0,0], dtype=numpy.bool_)
>>> av, index = locate_hyper_partner(matrix, vector)
>>> av.astype(int)
array([0, 1, 1, 0, 0, 0, 0, 0])
>>> index
1

See Also: _locate_hyper_partner, build_hyper_partner, _build_hyper_partner