qiskit_qec.linear.symplectic_product

symplectic_product(mat1, mat2)[source]

Returns the symplectic product of two GF(2) symplectic matrices.

Let math:’A’, math:’B’ be two GF(2) symplectic matrices of width math:’2m’, then the symplectic product is defined as

\[(A,B) = A \cdot \Lambda_n \cdot B^T.\]
Parameters:
  • mat1 (ndarray) – Input GF(2) symplectic matrixes

  • mat2 (ndarray) – Input GF(2) symplectic matrixes

Return type:

Union[int, ndarray]

Returns:

Symplectic product of mat1 and mat2

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

  • QiskitError – Input matrices must have the same number of dimensions

  • QiskitError – Input matrices must be 1 or 2 dimensional

Examples

>>> mat1 = numpy.array([[1,0,1,1],[0,1,1,0]], dtype=numpy.bool_)
>>> mat2 = numpy.array([[0,1,1,1],[0,0,1,0]], dtype=numpy.bool_)
>>> p = symplectic_product(mat1, mat2)
>>> p.astype(int)
array([[0, 1], [1, 0]]

See Also: _symplectic_product_vv, _symplectic_product_dense