qsearch.compiler

This module defines the Compiler class, which is a framework for classes that take a unitary and return a circuit implementing that unitary.

The default implementation SearchCompiler is also defined here. SearchCompiler compiles the desired unitary using an A* search strategy, as described in the paper Towards Optimal Topology Aware Quantum Circuit Synthesis.

Module Contents

Classes

Compiler

This class defines the pattern for compilers that convert a unitary matrix to a circuit that implements that matrix.

SearchCompiler

This Compiler uses an A* search strategy to synthesize a unitary, as described in the paper Towards Optimal Topology Aware Quantum Circuit Synthesis.

class qsearch.compiler.Compiler(options=Options())

This class defines the pattern for compilers that convert a unitary matrix to a circuit that implements that matrix.

abstract compile(options)
class qsearch.compiler.SearchCompiler(options=Options())

Bases: Compiler

This Compiler uses an A* search strategy to synthesize a unitary, as described in the paper Towards Optimal Topology Aware Quantum Circuit Synthesis.

Options:

target (required) : The unitary matrix to be synthesized, in the form of a numpy ndarray with dtype=”complex128”. gateset : The Gateset used for synthesis. weight_limit : A limit on the maximum weight for circuits to be expanded for further searching. See gatesets.py for more information. The default is None for unlimited. heuristic : A heuristic used to order the search tree. See heuristics.py for more information. solver : A Solver used for optimizing the parameters in parameterized circuits generated by the search tree. parallelizer : A Parallelizer used for solving multiple parameterized circuits in parallel. beams : The number of nodes to pop from the search tree at a time. The default value of -1 will create enough branches to maximize utilization of your CPU. objective : An Objective used for scoring the quality of a parameterization for both synthesis and search. timeout : An uper limit on the amount of time the compiler will spend trying to synthesize a circuit. The default is float(‘inf’), for unlimited. checkpoint : The compiler will use this Checkpoint to save intermediate state, and will resume from this Checkpoint if there was an existing state. logger : A qsearch.logging.Logger that will be used for logging the synthesis process.

Parameters:

options – See class level documentation for the options SearchCompiler uses

compile(options=Options())
Parameters:

options – See class level documentation for the options SearchCompiler uses