mqt.qecc.codes.constructions.hypergraph_product_code

Hypergraph product code constructions (3D and 4D, dense and sparse).

Functions

generate_4d_product_code(a_1, a_2, a_3, p, *[, checks]) → tuple[numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32]]

Generate the boundary maps of a 4D hypergraph product code (dense).

generate_3d_product_code(a_1, a_2, p) → tuple[numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32]]

Generate the boundary maps of a 3D hypergraph product code (dense).

generate_sparse_4d_product_code(a_1, a_2, a_3, p, *[, ...]) → tuple[scipy.sparse.csr_matrix, scipy.sparse.csr_matrix, scipy.sparse.csr_matrix, scipy.sparse.csr_matrix]

Generate the boundary maps of a 4D hypergraph product code (sparse).

generate_sparse_3d_product_code(a_1, a_2, p) → tuple[scipy.sparse.csr_matrix, scipy.sparse.csr_matrix, scipy.sparse.csr_matrix]

Generate the boundary maps of a 3D hypergraph product code (sparse).

Module Contents

generate_4d_product_code(a_1: numpy.typing.NDArray[numpy.int32], a_2: numpy.typing.NDArray[numpy.int32], a_3: numpy.typing.NDArray[numpy.int32], p: numpy.typing.NDArray[numpy.int32], *, checks: bool = True) → tuple[numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32]][source]

Generate the boundary maps of a 4D hypergraph product code (dense).

Builds the 4D chain complex from the boundary maps a_1, a_2, a_3 of a 3D input complex and a classical seed parity-check matrix p. The inputs must be compatible, i.e. consecutive maps compose to zero over GF(2).

Parameters:
  • a_1 – First boundary map of the 3D input complex.

  • a_2 – Second boundary map of the 3D input complex.

  • a_3 – Third boundary map of the 3D input complex.

  • p – Parity-check matrix of the classical seed code.

  • checks – If True, verify that the resulting boundary maps square to zero over GF(2).

Returns:

The four boundary maps (mx, hx, hz^T, mz^T) of the 4D complex.

Raises:

RuntimeError – If checks is enabled and the boundary maps do not square to zero.

generate_3d_product_code(a_1: numpy.typing.NDArray[numpy.int32], a_2: numpy.typing.NDArray[numpy.int32], p: numpy.typing.NDArray[numpy.int32]) → tuple[numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32]][source]

Generate the boundary maps of a 3D hypergraph product code (dense).

Builds the 3D chain complex from the boundary maps a_1, a_2 of a 2D input complex and a classical seed parity-check matrix p. The inputs must be compatible, i.e. a_1 @ a_2 is zero over GF(2).

Parameters:
  • a_1 – First boundary map of the 2D input complex.

  • a_2 – Second boundary map of the 2D input complex.

  • p – Parity-check matrix of the classical seed code.

Returns:

The three boundary maps (hx, hz^T, mz^T) of the 3D complex.

Raises:

RuntimeError – If the boundary maps do not square to zero over GF(2).

generate_sparse_4d_product_code(a_1: csr_matrix, a_2: csr_matrix, a_3: csr_matrix, p: csr_matrix, *, checks: bool = True) → tuple[csr_matrix, csr_matrix, csr_matrix, csr_matrix][source]

Generate the boundary maps of a 4D hypergraph product code (sparse).

Sparse counterpart of generate_4d_product_code(); see there for the input requirements.

Parameters:
  • a_1 – First boundary map of the 3D input complex.

  • a_2 – Second boundary map of the 3D input complex.

  • a_3 – Third boundary map of the 3D input complex.

  • p – Parity-check matrix of the classical seed code.

  • checks – If True, verify that the resulting boundary maps square to zero over GF(2).

Returns:

The four boundary maps (mx, hx, hz^T, mz^T) of the 4D complex.

Raises:

RuntimeError – If checks is enabled and the boundary maps do not square to zero.

generate_sparse_3d_product_code(a_1: csr_matrix, a_2: csr_matrix, p: csr_matrix) → tuple[csr_matrix, csr_matrix, csr_matrix][source]

Generate the boundary maps of a 3D hypergraph product code (sparse).

Sparse counterpart of generate_3d_product_code(); see there for the input requirements.

Parameters:
  • a_1 – First boundary map of the 2D input complex.

  • a_2 – Second boundary map of the 2D input complex.

  • p – Parity-check matrix of the classical seed code.

Returns:

The three boundary maps (hx, hz^T, mz^T) of the 3D complex.

Raises:

RuntimeError – If the boundary maps do not square to zero over GF(2).