Skip to content

QuantumApplicationLab/QuantumNewtonRaphson

Repository files navigation

Platform github repo badge github license badge Python Code style: Black Tests Coverage Status

Quantum Newton Raphson

The QuantunNewtonRaphson allows to offload the gradient calculation of the Newton-Raphson algorithm to a variety of quantum linear solvers.

Installation

To install quantum_newton_raphson from GitHub repository, do:

git clone git@github.com:QuantumApplicationLab/quantumnewtonraphson.git
cd quantumnewtonraphson
python -m pip install .

Example

from qiskit.primitives import Estimator, Sampler
from quantum_newton_raphson.newton_raphson import newton_raphson
from quantum_newton_raphson.hhl_solver import HHL_SOLVER

def func(input):
  """non linear function to be solved: func(x) = 0."""
  ...
  return output

estimator = Estimator()
sampler = Sampler()

# define the linear solver with the reorder solver
solver = HHL_SOLVER(estimator=estimator, sampler=sampler)

# Solve the newton raphson problem
res = newton_raphson(
    func, np.random.rand(2), linear_solver=solver, verbose=True, max_iter=25
)

Contributing

If you want to contribute to the development of quantum_newton_raphson, have a look at the contribution guidelines.

Credits

This package was created with Cookiecutter and the NLeSC/python-template.

About

Quantum Newton Raphson Solver

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •