mqt.qecc.codes.core.symplectic

Classes and Methods for working with symplectic vector spaces.

Classes

SymplecticVector

Symplectic Vector Class.

SymplecticMatrix

Symplectic Matrix Class.

Functions

symplectic_product(lhs, rhs) → numpy.int8 | numpy.typing.NDArray[numpy.int8]

Compute the binary symplectic product of vectors or row matrices.

Module Contents

symplectic_product(lhs: numpy.typing.NDArray[numpy.int8], rhs: numpy.typing.NDArray[numpy.int8]) → numpy.int8 | numpy.typing.NDArray[numpy.int8][source]

Compute the binary symplectic product of vectors or row matrices.

Both operands are interpreted in [X | Z] form, i.e. the first half of each row is the X part and the second half is the Z part.

Parameters:
  • lhs – A vector of length 2n or a matrix whose rows have length 2n.

  • rhs – A vector of length 2n or a matrix whose rows have length 2n.

Returns:

A scalar for vector/vector input, a vector for vector/matrix or matrix/vector input, and a matrix for matrix/matrix input.

Raises:

ValueError – If an operand is not one- or two-dimensional, has an odd or zero width, or the operands represent different numbers of qubits.

class SymplecticVector(vector: numpy.typing.NDArray[numpy.int8])[source]

Symplectic Vector Class.

copy() → SymplecticVector[source]

Return a copy of the vector.

classmethod zeros(n: int) → SymplecticVector[source]

Create a zero vector of length n.

classmethod ones(n: int) → SymplecticVector[source]

Create a ones vector of length n.

class SymplecticMatrix(matrix: numpy.typing.NDArray[numpy.int8])[source]

Symplectic Matrix Class.

copy() → SymplecticMatrix[source]

Return a copy of the matrix.

classmethod zeros(n_rows: int, n: int) → SymplecticMatrix[source]

Create a zero matrix of size n.

classmethod identity(n: int) → SymplecticMatrix[source]

Create the identity matrix of size n.

classmethod symplectic_identity(n: int) → SymplecticMatrix[source]

Create the identity matrix of size n.

classmethod empty(n: int) → SymplecticMatrix[source]

Create an empty matrix of size n.