|
Sequential Quantum Gate Decomposer
v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
Functions | |
| def | build_dependency |
| def | gate_desc_to_gate_index (circ, preparts, qubit_groups_only=False) |
| def | get_bqskit_partitions (filename, max_partition_size, partitioner) |
| def | get_float_ops (num_qubit, gate_qubits, control_qubits, is_pure=False, io_penalty=48) |
| def | get_qiskit_fusion_partitions (filename, max_partition_size) |
| def | get_qiskit_partitions (filename, max_partition_size) |
| def | get_qubits |
| def | parts_to_float_ops (num_qubit, gate_to_qubit, gate_to_tqubit, allparts) |
| def | qiskit_to_squander_name (qiskit_name) |
| def | total_float_ops (num_qubit, max_qubits_per_partition, gate_to_qubit, gate_to_tqubit, allparts) |
| def | translate_param_order |
| def tools.build_dependency | ( | c | ) |
| def tools.gate_desc_to_gate_index | ( | circ, | |
| preparts, | |||
qubit_groups_only = False |
|||
| ) |
| def tools.get_bqskit_partitions | ( | filename, | |
| max_partition_size, | |||
| partitioner | |||
| ) |
Partition circuit using BQSKit partitioners
Args:
filename: QASM file path
max_partition_size: Max qubits per partition
partitioner: BQSKit Partitioning strategy
Returns:
Parameters, partitioned circuit, parameter order (source_idx, dest_idx, param_count), partitions
Definition at line 359 of file tools.py.

| def tools.get_float_ops | ( | num_qubit, | |
| gate_qubits, | |||
| control_qubits, | |||
is_pure = False, |
|||
io_penalty = 48 |
|||
| ) |
Compute the number of floating-point operations (FLOPs) required
for simulating a quantum gate acting on a set of qubits.
Args:
num_qubit (int): Total number of qubits in the system.
gate_qubits (int): Number of qubits the gate acts on (including controls).
control_qubits (int): Number of control qubits for the gate.
is_pure (bool, optional): Whether the gate is a "pure" controlled gate
(i.e., all controlled gates share the same target qubit). Defaults to False.
Returns:
int: Estimated number of floating-point operations required.
Definition at line 26 of file tools.py.

| def tools.get_qiskit_fusion_partitions | ( | filename, | |
| max_partition_size | |||
| ) |
Generate circuit partitions from a QASM file using Qiskit's fusion
metadata and Squander's partitioning utilities.
This function:
1. Parses the QASM file into a Squander circuit.
2. Runs the circuit on Qiskit's AerSimulator with gate fusion enabled.
3. Extracts the fusion metadata (grouped qubit operations).
4. Uses Squander's Kahn-based partitioning to produce circuit partitions.
Args:
filename (str): Path to the QASM file to be parsed.
max_partition_size (int): Maximum number of qubits allowed in each
fusion partition (i.e., `fusion_max_qubit` for Qiskit).
Returns:
tuple:
parameters (list): Parameter list extracted from the Squander circuit.
partitioned_circ (object): Partitioned Squander circuit object.
param_order (list): Order of parameters corresponding to the partitioned circuit.
parts (list[list]): Partitioning of the circuit into gate groups,
represented as lists of gate indices.
Definition at line 302 of file tools.py.

| def tools.get_qiskit_partitions | ( | filename, | |
| max_partition_size | |||
| ) |
Partition circuit using Qiskit multi-qubit blocks
Args:
filename: QASM file path
max_partition_size: Max qubits per partition
Returns:
Parameters, partitioned circuit, parameter order (source_idx, dest_idx, param_count), partitions
Definition at line 259 of file tools.py.

| def tools.get_qubits | ( | gate | ) |
| def tools.parts_to_float_ops | ( | num_qubit, | |
| gate_to_qubit, | |||
| gate_to_tqubit, | |||
| allparts | |||
| ) |
Compute FLOPs for each partition of gates in a quantum circuit.
Args:
num_qubit (int): Total number of qubits in the system.
gate_to_qubit (dict): Mapping from gate ID to the set of qubits
it acts on.
gate_to_tqubit (dict or None): Mapping from gate ID to its target qubit
(used for distinguishing control vs. target qubits). If None,
control qubits are assumed to be 0.
allparts (list[list]): Partitioning of gates, where each part is a
collection (e.g., list or set) of gate IDs.
Returns:
list[int]: FLOP counts for each partition in `allparts`.
Definition at line 48 of file tools.py.


| def tools.qiskit_to_squander_name | ( | qiskit_name | ) |
| def tools.total_float_ops | ( | num_qubit, | |
| max_qubits_per_partition, | |||
| gate_to_qubit, | |||
| gate_to_tqubit, | |||
| allparts | |||
| ) |
Compute the total FLOPs across all partitions of a quantum circuit,
scaled by the number of qubits outside the maximum partition.
Args:
num_qubit (int): Total number of qubits in the system.
max_qubits_per_partition (int): Maximum number of qubits any partition
can act on.
gate_to_qubit (dict): Mapping from gate ID to the set of qubits
it acts on.
gate_to_tqubit (dict or None): Mapping from gate ID to its target qubit.
If None, control qubits are assumed to be 0.
allparts (list[list]): Partitioning of gates, where each part is a
collection of gate IDs.
Returns:
int: Total number of floating-point operations across all partitions.
Definition at line 86 of file tools.py.


1.8.13