:py:mod:`qsearch.solvers` ========================= .. py:module:: qsearch.solvers .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: qsearch.solvers.Solver qsearch.solvers.CMA_Solver qsearch.solvers.COBYLA_Solver qsearch.solvers.DIY_Solver qsearch.solvers.BFGS_Jac_Solver qsearch.solvers.LeastSquares_Jac_Solver Functions ~~~~~~~~~ .. autoapisummary:: qsearch.solvers.default_solver .. py:function:: default_solver(options, x0=None) Runs a complex list of tests to determine the best Solver for a specific situation. .. py:class:: Solver This class is used to wrap numerical optimizers for circuit solving. .. py:property:: distance_metric .. py:method:: solve_for_unitary(circuit, options, x0=None) :abstractmethod: Finds the best parameters that minimize error_func or error_residuals between the unitary from the circuit and options.target. .. py:method:: __eq__(other) Return self==value. .. py:class:: CMA_Solver Bases: :py:obj:`Solver` Uses cmaes gradient-free optimization from the cma package. .. py:method:: 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. .. py:class:: COBYLA_Solver Bases: :py:obj:`Solver` Uses cobyla gradient-free optimization from scipy. .. py:method:: 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. .. py:class:: DIY_Solver(f) Bases: :py:obj:`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. .. py:method:: 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. .. py:class:: BFGS_Jac_Solver Bases: :py:obj:`Solver` A solver based on the BFGS implementation in scipy. It requires gradients. .. py:method:: 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. .. py:class:: LeastSquares_Jac_Solver Bases: :py:obj:`Solver` Uses the Leavenberg-Marquardt least-squares optimizer in scipy. .. py:property:: distance_metric .. py:method:: 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.