mqt.qecc.cococo.internal_testing

Helper functions to perform testing.

Functions

extract_gates_schedule(schedule) → collections.abc.Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]]

Extracts the gates from the schedule in the order of the schedule. ignore 'idle' moves in the vdp dict.

extract_gates_schedule_respect_layout(schedule) → collections.abc.Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]]

Extracts the gates with the qubit labels (not the positions of quibts) by respecting the changing layout dictionaries.

check_num_gates(terminal_pairs, schedule) → bool

Check that the input terminal_pairs has the same number of gates as the resulting schedule.

random_initial_state(n_qubits) → stim.Circuit

Creates some random circuit in stim for a random initial state.

check_order_dyn_gates_st(terminal_pairs, vdp_layers[, ...]) → bool

Only works for circuits and the standard scheme, i.e. find_total_vdp_layers_dyn.

check_order_dyn_gates(terminal_pairs, schedule) → bool

Checks order of the schedule.

check_duplicate_nodes_per_layer_st(vdp_layers) → bool

Checks whether there are duplicate nodes in the paths of one layer.

check_duplicate_nodes_per_layer(schedule) → bool

Checks whether there are duplicate nodes in the paths of one layer.

check_path_on_logical_st(vdp_layers, logical_pos) → bool

Checks whether the path occupies any logical pos somewhere else than on the end points. this would be an issue!

check_path_on_logical(schedule) → bool

Checks whether a path / tree occupies any logical pos somewhere else than at the end points.

test_times_t_gates_opt(schedule, t, factories) → bool

Checks whether the t timestamps make sense in a finished schedule (opt).

test_times_t_gates_st(vdp_layers, t, factories) → bool

Checks whether the t timestamps make sense in a finished vdp layeyrs (st).

Module Contents

extract_gates_schedule(schedule: Any) → Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]][source]

Extracts the gates from the schedule in the order of the schedule. ignore ‘idle’ moves in the vdp dict.

extract_gates_schedule_respect_layout(schedule: Any) → Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]][source]

Extracts the gates with the qubit labels (not the positions of quibts) by respecting the changing layout dictionaries.

check_num_gates(terminal_pairs: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]], schedule: Any) → bool[source]

Check that the input terminal_pairs has the same number of gates as the resulting schedule.

random_initial_state(n_qubits: int) → stim.Circuit[source]

Creates some random circuit in stim for a random initial state.

check_order_dyn_gates_st(terminal_pairs: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]], vdp_layers: list[mqt.qecc.cococo.types.VdpDict], layout: dict[int, mqt.qecc.cococo.types.pos] | None = None) → bool[source]

Only works for circuits and the standard scheme, i.e. find_total_vdp_layers_dyn.

Includes both CNOT and T gates in a circuit.

check_order_dyn_gates(terminal_pairs: Sequence[mqt.qecc.cococo.types.pos | tuple[mqt.qecc.cococo.types.pos, mqt.qecc.cococo.types.pos]], schedule: Any) → bool[source]

Checks order of the schedule.

simulates the gate order in the schedule (changed from pushing) and from initial terminal pairs on a random initial state. the results must coincide to make sure that the pushing is performed correctly.

check_duplicate_nodes_per_layer_st(vdp_layers: list[mqt.qecc.cococo.types.VdpDict]) → bool[source]

Checks whether there are duplicate nodes in the paths of one layer.

this would indicate that there are overlapping paths and is a big problem.

check_duplicate_nodes_per_layer(schedule: Any) → bool[source]

Checks whether there are duplicate nodes in the paths of one layer.

this would indicate that there are overlapping paths and is a big problem.

check_path_on_logical_st(vdp_layers: list[mqt.qecc.cococo.types.VdpDict], logical_pos: list[mqt.qecc.cococo.types.pos]) → bool[source]

Checks whether the path occupies any logical pos somewhere else than on the end points. this would be an issue!

check_path_on_logical(schedule: Any) → bool[source]

Checks whether a path / tree occupies any logical pos somewhere else than at the end points.

test_times_t_gates_opt(schedule: Any, t: int, factories: list[mqt.qecc.cococo.types.pos]) → bool[source]

Checks whether the t timestamps make sense in a finished schedule (opt).

Only the vdp_dict per layer is checked here, the trees are not considered.

test_times_t_gates_st(vdp_layers: list[mqt.qecc.cococo.types.VdpDict], t: int, factories: list[mqt.qecc.cococo.types.pos]) → bool[source]

Checks whether the t timestamps make sense in a finished vdp layeyrs (st).