Using classical optimization tools, the cost function (REF ) is minimized with \(\theta \)  updated iteratively until convergence is reached. The optimization process follows either a gradient-based or gradient-free approach, depending on how the gradient of the cost function is evaluated. A gradient-free optimizer is guided by an estimate of the inverse Hessian matrix, whereas a gradient-based optimizer by the partial derivative of the cost function \(E\)  with respect to parameters \(\theta \) , i.e. \(\partial E /\partial \theta \) , which can be evaluated by a quantum computer (for details, see [1]}, [2]}). Regardless of the choice of gradient optimizer used, the optimization routine halts when the cost error falls under a convergence threshold (\(\epsilon < \epsilon _{\mathrm {tol}}\) ) whence the parameters are at optimum \(\theta =\theta _\mathrm {opt}\) . The converged solution vector \(| u \rangle  = r_{\mathrm {opt}} | \psi (\theta _{\mathrm {opt}} \rangle \)  satisfies [3]}
\(r_{\mathrm {opt}}A\left|\psi \left(\theta _{\mathrm {opt}}\right)\right\rangle =|b\rangle \) 
