Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Functions
tdag Namespace Reference

Functions

def _enumerate (target_gate, target_qubit, input_groups, deps, g, gate_to_qubit, S, max_qubit)
 
def _enumerate_groups (g, rg, gate_to_qubit, S, max_qubit, use_gtqcp)
 
def _enumerate_gtqcp (target_gate, target_qubit, input_groups, deps, g, gate_to_qubit, S, max_qubit)
 
def _get_gate_dependencies (g, rg, gate_to_qubit, S, max_qubit)
 
def _get_starting_gates (g, rg, gate_to_qubit, S)
 
def _remove_best_partition (qubit_results, g, rg, gate_to_qubit, start_qubit, deps)
 
def _test_gtqcp ()
 
def _test_tdag ()
 
def _test_tdag_qasm (use_gtqcp=False)
 
def _test_tdag_single_qubit ()
 
def tdag_max_partitions (c, max_qubit, use_gtqcp=False)
 

Function Documentation

◆ _enumerate()

def tdag._enumerate (   target_gate,
  target_qubit,
  input_groups,
  deps,
  g,
  gate_to_qubit,
  S,
  max_qubit 
)
private
Recursively enumerate gate groups for a target gate

Args:
    
    target_gate: Gate to start enumeration
    
    target_qubit: Qubit index
    
    input_groups: Current qubit groups
    
    deps: Gate dependencies
    
    g: Forward dependency graph
    
    gate_to_qubit: Mapping of gates to qubits

    S: Starting gates per qubit
    
    max_qubit: Max qubits per partition

Returns:
    
    Set of valid qubit groups

Definition at line 137 of file tdag.py.

◆ _enumerate_groups()

def tdag._enumerate_groups (   g,
  rg,
  gate_to_qubit,
  S,
  max_qubit,
  use_gtqcp 
)
private
Enumerate possible gate groups for partitioning

Args:
    
    g: Forward dependency graph
    
    rg: Reverse dependency graph
    
    gate_to_qubit: Mapping of gates to qubits
    
    S: Starting gates per qubit
    
    max_qubit: Max qubits per partition
    
    use_gtqcp: Use GTQCP variant

Returns:
   
    Set of gate groups and their dependencies

Definition at line 107 of file tdag.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _enumerate_gtqcp()

def tdag._enumerate_gtqcp (   target_gate,
  target_qubit,
  input_groups,
  deps,
  g,
  gate_to_qubit,
  S,
  max_qubit 
)
private
Recursively enumerate gate groups for a target gate using GTQCP variant.

Args:
    
    target_gate: Gate to start enumeration
    
    target_qubit: Qubit index
    
    input_groups: Current qubit groups
    
    deps: Gate dependencies
    
    g: Forward dependency graph
    
    gate_to_qubit: Mapping of gates to qubits
    
    S: Starting gates per qubit
    
    max_qubit: Max qubits per partition

Returns:
    
    Set of valid qubit groups

Definition at line 185 of file tdag.py.

◆ _get_gate_dependencies()

def tdag._get_gate_dependencies (   g,
  rg,
  gate_to_qubit,
  S,
  max_qubit 
)
private
Get gate dependencies for each gate within qubit constraints

Args:
    
    g: Forward dependency graph
    
    rg: Reverse dependency graph
    
    gate_to_qubit: Mapping of gates to qubits
    
    S: Starting gates per qubit
    
    max_qubit: Max qubits per partition

Returns:
    
    Dictionary of gate dependencies

Definition at line 70 of file tdag.py.

Here is the caller graph for this function:

◆ _get_starting_gates()

def tdag._get_starting_gates (   g,
  rg,
  gate_to_qubit,
  S 
)
private
Get starting gates for each qubit in the circuit

Args:
    
    g: Forward dependency graph
    
    rg: Reverse dependency graph
    
    gate_to_qubit: Mapping of gates to qubits
    
    S: Set of initial gates

Returns:
    
    Dictionary mapping qubits to their starting gates

Definition at line 8 of file tdag.py.

Here is the caller graph for this function:

◆ _remove_best_partition()

def tdag._remove_best_partition (   qubit_results,
  g,
  rg,
  gate_to_qubit,
  start_qubit,
  deps 
)
private
Remove the best partition from the dependency graphs

Args:
    
    qubit_results: Candidate qubit groups
    
    g: Forward dependency graph
    
    rg: Reverse dependency graph
    
    gate_to_qubit: Mapping of gates to qubits
    
    start_qubit: Starting gates per qubit
    
    deps: Gate dependencies

Returns:
    
    List of gate indices in the best partition

Definition at line 233 of file tdag.py.

Here is the caller graph for this function:

◆ _test_gtqcp()

def tdag._test_gtqcp ( )
private
Test GTQCP variant for TDAG partitioning

Definition at line 313 of file tdag.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _test_tdag()

def tdag._test_tdag ( )
private
Test TDAG partitioning on a sample circuit

Definition at line 348 of file tdag.py.

Here is the call graph for this function:

◆ _test_tdag_qasm()

def tdag._test_tdag_qasm (   use_gtqcp = False)
private
Test TDAG partitioning on a QASM file

Args:
    
    use_gtqcp: Use GTQCP variant

Definition at line 271 of file tdag.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _test_tdag_single_qubit()

def tdag._test_tdag_single_qubit ( )
private
Test TDAG partitioning on a simple two-qubit circuit

Definition at line 290 of file tdag.py.

Here is the call graph for this function:

◆ tdag_max_partitions()

def tdag.tdag_max_partitions (   c,
  max_qubit,
  use_gtqcp = False 
)
Partition a circuit using TDAG algorithm

Args:
    
    c: SQUANDER Circuit to partition
    
    max_qubit: Max qubits per partition
    
    use_gtqcp: Use GTQCP variant

Returns:
   
    Partitioned circuit, parameter order (source_idx, dest_idx, param_count), partition assignments

Definition at line 43 of file tdag.py.

Here is the call graph for this function:
Here is the caller graph for this function: