deltakit.explorer.codes.RepetitionCode.from_matrix#

static RepetitionCode.from_matrix(h_x: ndarray[tuple[Any, ...], dtype[_ScalarT]] = array([], shape=(0, 0), dtype=float64), h_z: ndarray[tuple[Any, ...], dtype[_ScalarT]] = array([], shape=(0, 0), dtype=float64), log_x_ops: ndarray[tuple[Any, ...], dtype[_ScalarT]] = array([], shape=(0, 0), dtype=float64), log_z_ops: ndarray[tuple[Any, ...], dtype[_ScalarT]] = array([], shape=(0, 0), dtype=float64)) CSSCode#

Return a CSSCode object with stabilisers that have no ancilla qubits. The inputs must be 0-1 matrices.

Parameters:
  • h_x (NDArray, optional) – The check matrix (containing only 0 and 1) for X stabilisers where each row represents an X stabiliser. If an empty matrix, then this means the CSS code has no X stabilisers. By default, np.zeros((0,0)).

  • h_z (NDArray, optional) – The check matrix (containing only 0 and 1) for Z stabilisers where each row represents a Z stabiliser. If an empty matrix, then this means the CSS code has no Z stabilisers. By default, np.zeros((0,0)).

  • log_x_ops (NDArray, optional) – Matrix (containing only 0 and 1) representing the logical X operators where each row represents a logical X operator. If an empty matrix, then this means the CSS code was specified without X logical operators. By default, np.zeros((0,0)).

  • log_z_ops (NDArray, optional) – Matrix (containing only 0 and 1) representing the logical Z operators where each row represents a logical Z operator. If an empty matrix, then this means the CSS code was specified without Z logical operators. By default, np.zeros((0,0)).

Returns:

The CSS code obtained from the matrix input.

Return type:

CSSCode

Raises:
  • ValueError – If both matrices h_x and h_z are empty.

  • ValueError – If neither of the matrices h_x_and h_z is empty but they have different numbers of columns.

  • ValueError – If the numbers of rows differ for the matrices log_x_ops and log_z_ops.

  • ValueError – If either log_x_ops or log_z_ops has a different number of columns to h_x or h_z.

  • ValueError – If any of the inputs have elements that are different from 0 and 1.