qsearch.solvers

Defines Solver, a class used to wrap various numerical optimizers for finding parameters such that an ansatz circuit is a solution to a target unitary.

Module Contents

Classes

Solver

This class is used to wrap numerical optimizers for circuit solving.

CMA_Solver

Uses cmaes gradient-free optimization from the cma package.

COBYLA_Solver

Uses cobyla gradient-free optimization from scipy.

DIY_Solver

An easier way to wrap a numerical optimizer than writing your own Solver class.

BFGS_Jac_Solver

A solver based on the BFGS implementation in scipy. It requires gradients.

LeastSquares_Jac_Solver

Uses the Leavenberg-Marquardt least-squares optimizer in scipy.

Functions

default_solver(options[, x0])

Runs a complex list of tests to determine the best Solver for a specific situation.

qsearch.solvers.default_solver(options, x0=None)

Runs a complex list of tests to determine the best Solver for a specific situation.

class qsearch.solvers.Solver

This class is used to wrap numerical optimizers for circuit solving.

property distance_metric
abstract solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.

__eq__(other)

Return self==value.

class qsearch.solvers.CMA_Solver

Bases: Solver

Uses cmaes gradient-free optimization from the cma package.

solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.

class qsearch.solvers.COBYLA_Solver

Bases: Solver

Uses cobyla gradient-free optimization from scipy.

solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.

class qsearch.solvers.DIY_Solver(f)

Bases: Solver

An easier way to wrap a numerical optimizer than writing your own Solver class.

Uses the function f that takes in eval_func and initial_guess and returns the parameters that minimizes eval_func.

solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.

class qsearch.solvers.BFGS_Jac_Solver

Bases: Solver

A solver based on the BFGS implementation in scipy. It requires gradients.

solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.

class qsearch.solvers.LeastSquares_Jac_Solver

Bases: Solver

Uses the Leavenberg-Marquardt least-squares optimizer in scipy.

property distance_metric
solve_for_unitary(circuit, options, x0=None)

Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target.