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

Functions

def normalize_state (state)
 
def preprocess_qasm_angles
 
def projectq_import_qasm (filename, eng, initial_state=None)
 
def purity_analysis ()
 
def state_vector_equivalence (psi, phi)
 
def test_partitions (max_qubits=4)
 
def test_simulation (max_qubits=4, random_initial_state=True)
 

Variables

int MAX_GATES_ALLOWED = 1024**2
 
list METHOD_NAMES
 
dictionary SUPPORTED_GATES = {x for n in dir(gate) for x in (getattr(gate, n),) if not n.startswith("_") and issubclass(x, gate.Gate) and n != "Gate"}
 
dictionary SUPPORTED_GATES_NAMES = {n for n in dir(gate) if not n.startswith("_") and issubclass(getattr(gate, n), gate.Gate) and n != "Gate"}
 
bool USE_ILP = True
 

Function Documentation

◆ normalize_state()

def benchmark.normalize_state (   state)

Definition at line 405 of file benchmark.py.

Here is the caller graph for this function:

◆ preprocess_qasm_angles()

def benchmark.preprocess_qasm_angles (   qasm)

Definition at line 365 of file benchmark.py.

Here is the caller graph for this function:

◆ projectq_import_qasm()

def benchmark.projectq_import_qasm (   filename,
  eng,
  initial_state = None 
)

Definition at line 308 of file benchmark.py.

Here is the caller graph for this function:

◆ purity_analysis()

def benchmark.purity_analysis ( )
Run a small symbolic experiment to study “purity” and “sparsity” of control sets.

This routine builds a set of helper functions and 1q/2q/3q gate factories with SymPy,
then:
  1) Checks which qubit subsets act as pure/sparse controls for some canonical gates
     (e.g., U3 on 1q, CRY on 2q, CCX on 3q).
  2) Composes short circuits (e.g., U3 on qubit i followed by CRY(0,1)) and reports
     which control subsets remain pure/sparse after composition.
  3) Prints the identified “pure” and “sparsity” control sets for each experiment.

Notes:
  - Endianness is governed by the local variable `little_endian` (default: True).
  - `apply_to` operates on full operators (2^n × 2^n), not statevectors.
  - Requires SymPy. The helper `apply_to` also uses `itertools.product`.

Args:
    None

Returns:
    None
        Results are printed to stdout; the function is intended as a diagnostic/demo.

Definition at line 33 of file benchmark.py.

Here is the call graph for this function:

◆ state_vector_equivalence()

def benchmark.state_vector_equivalence (   psi,
  phi 
)
Checks if two quantum state vectors are equal up to a global phase.

Definition at line 407 of file benchmark.py.

Here is the call graph for this function:

◆ test_partitions()

def benchmark.test_partitions (   max_qubits = 4)
Benchmark partitioning strategies on QASM circuits
Args:
    
    max_qubits: Max qubits per partition

Definition at line 527 of file benchmark.py.

Here is the call graph for this function:

◆ test_simulation()

def benchmark.test_simulation (   max_qubits = 4,
  random_initial_state = True 
)

Definition at line 419 of file benchmark.py.

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

Variable Documentation

◆ MAX_GATES_ALLOWED

int benchmark.MAX_GATES_ALLOWED = 1024**2

Definition at line 14 of file benchmark.py.

◆ METHOD_NAMES

list benchmark.METHOD_NAMES
Initial value:
1 = [
2  "kahn",
3  "tdag",
4  "gtqcp",
5  "qiskit",
6  "qiskit-fusion",
7  "bqskit-Quick",
8  # "bqskit-Greedy",
9  # "bqskit-Scan",
10  # "bqskit-Cluster",
11 ] + (["ilp", "ilp-fusion", #"ilp-fusion-ca"
12  ] if USE_ILP else [])

Definition at line 16 of file benchmark.py.

◆ SUPPORTED_GATES

dictionary benchmark.SUPPORTED_GATES = {x for n in dir(gate) for x in (getattr(gate, n),) if not n.startswith("_") and issubclass(x, gate.Gate) and n != "Gate"}

Definition at line 30 of file benchmark.py.

◆ SUPPORTED_GATES_NAMES

dictionary benchmark.SUPPORTED_GATES_NAMES = {n for n in dir(gate) if not n.startswith("_") and issubclass(getattr(gate, n), gate.Gate) and n != "Gate"}

Definition at line 31 of file benchmark.py.

◆ USE_ILP

bool benchmark.USE_ILP = True

Definition at line 12 of file benchmark.py.