qsearch.leap_compiler

This module provides LeapCompiler, which is a more scalable variant of SearchCompiler, at the expense of producing somewhat longer circuits. LeapReoptimizing_PostProcessor can be used to reduce circuit length back to levels that SearchCompiler might generate.

Module Contents

Classes

LeapCompiler

LeapCompiler is a more scalable search based circuit compiler

SubCompiler

A modified SearchCompiler for the LeapCompiler to use.

Functions

cut_end(circ, depth)

qsearch.leap_compiler.cut_end(circ, depth)
class qsearch.leap_compiler.LeapCompiler(options=Options())

Bases: qsearch.compiler.Compiler

LeapCompiler is a more scalable search based circuit compiler

LeapCompiler uses fixed structure prefixes to greatly reduce the search space and speed up synthesis at the cost of optimiality. Thus it is recommended to use in conjunction with reoptimizing_compiler.LeapReoptimizing_PostProcessor() to obtain the best results.

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. error_func : The function that the Solver will attempt to minimize. eval_func : The function used by the heuristic in order to guide the search tree. By default this is equal to error_func. error_jac : A function that returns a tuple of the value that error_func would generate and the jacobian of error_func error_residuals : A function that returns an array of real-valued residuals to be used by a least-squares-based Solver. error_residuals_jac : A function that returns the jacobian of error_residuals (note that it does NOT return a tuple of the residuals and the jacobian). 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. min_depth : the minimum amount of searching

Run LEAP on the compilation specified in options.

Parameters:

options – options for the compilations, see the class level documentation for details.

compile(options=Options())

Run LEAP on the compilation specified in options.

Parameters:

options – options for the compilations, see the class level documentation for details.

class qsearch.leap_compiler.SubCompiler(options=Options())

Bases: qsearch.compiler.Compiler

A modified SearchCompiler for the LeapCompiler to use.

compile(options=Options())