qiskit_qec.linear.is_symplectic_matrix_form¶
- is_symplectic_matrix_form(matrix, dtype=None)[source]¶
Is the input matrix GF(2) symplectic
Checks if the given array-like matrix is in the form of a symplectic matrix: two dimensional, even number of columns, 0/1 or boolean entries. The optional argument dtype can be given to check if entries are a specific dtype
- Parameters:
matrix (
ndarray
) – Input matrix to be checkeddtype (
Union
[bool
,bool_
,int
,integer
,None
]) – Optional. Check if given matrix is of type dtype. Default: None
- Return type:
bool
- Returns:
True if the input matrix is GF(2) symplectic. False otherwise.
Examples
>>> matrix = numpy.array([[1,0,0,1,0,0,1,0],[0,1,1,1,0,0,0,1]], dtype=numpy.bool_) >>> is_symplectic_matrix_form(matrix) True
>>> matrix = numpy.array([[1,0,0,1,0,0,1],[0,1,1,1,0,0,0]], dtype=numpy.bool_) >>> is_symplectic_matrix_form(matrix) False
>>> matrix = numpy.array([[1,0,0,1],[0,1,1,1]], dtype=numpy.bool_) >>> is_symplectic_matrix_form(matrix, dtype=int) False
See Also: is_symplectic_vector_form, is_symplectic_form