$$\mathrm{Minimize}F\left(x\right)=\sum _{i=1}^{m}{\left[{f}_{i}\left(x\right)\right]}^{2}$$ |
x^{(k + 1)} = x^{(k)} + α^{(k)}p^{(k)}
$${x}^{(k+1)}={x}^{\left(k\right)}+{\alpha}^{\left(k\right)}{p}^{\left(k\right)}$$ |
Input Parameters
Output Parameters
Input Parameters
Output Parameters
$$\Vert {x}_{\mathrm{sol}}-{x}_{\mathrm{true}}\Vert <{\mathbf{xtol}}\times (1.0+\Vert {x}_{\mathrm{true}}\Vert )\text{,}$$ |
$$\sum _{j=1}^{n}{({x}_{j}^{\left(k\right)}-{x}_{j}^{(k-1)})}^{2}\le {\left({\mathbf{stepmx}}\right)}^{2}$$ |
J = USV^{T} $$J=US{V}^{\mathrm{T}}$$ |
Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.
On entry, | n < 1${\mathbf{n}}<1$, |
or | m < n${\mathbf{m}}<{\mathbf{n}}$, |
or | maxcal < 1${\mathbf{maxcal}}<1$, |
or | eta < 0.0${\mathbf{eta}}<0.0$, |
or | eta ≥ 1.0${\mathbf{eta}}\ge 1.0$, |
or | xtol < 0.0${\mathbf{xtol}}<0.0$, |
or | stepmx < xtol${\mathbf{stepmx}}<{\mathbf{xtol}}$, |
or | ldfjac < m$\mathit{ldfjac}<{\mathbf{m}}$, |
or | ldv < n$\mathit{ldv}<{\mathbf{n}}$, |
or | liw < 1$\mathit{liw}<1$, |
or | lw < 7 × n + m × n + 2 × m + n × n$\mathit{lw}<7\times {\mathbf{n}}+{\mathbf{m}}\times {\mathbf{n}}+2\times {\mathbf{m}}+{\mathbf{n}}\times {\mathbf{n}}$ when n > 1${\mathbf{n}}>1$, |
or | lw < 9 + 3 × m$\mathit{lw}<9+3\times {\mathbf{m}}$ when n = 1${\mathbf{n}}=1$. |
$$\begin{array}{lll}\mathrm{B1}& \equiv & {\alpha}^{\left(k\right)}\times \Vert {p}^{\left(k\right)}\Vert <({\mathbf{xtol}}+\epsilon )\times (1.0+\Vert {x}^{\left(k\right)}\Vert )\\ \mathrm{B2}& \equiv & |{F}^{\left(k\right)}-{F}^{(k-1)}|<{({\mathbf{xtol}}+\epsilon )}^{2}\times (1.0+{F}^{\left(k\right)})\\ \mathrm{B3}& \equiv & \Vert {g}^{\left(k\right)}\Vert <{\epsilon}^{1/3}\times (1.0+{F}^{\left(k\right)})\\ \mathrm{B4}& \equiv & {F}^{\left(k\right)}<{\epsilon}^{2}\\ \mathrm{B5}& \equiv & \Vert {g}^{\left(k\right)}\Vert <{(\epsilon \times \sqrt{{F}^{\left(k\right)}})}^{1/2}\end{array}$$ |
(a) | the sequence {F(x^{(k)})}$\left\{F\left({x}^{\left(k\right)}\right)\right\}$ converges to F(x_{sol})$F\left({x}_{\mathrm{sol}}\right)$ at a superlinear or a fast linear rate, and |
(b) | g(x_{sol})^{T} g(x_{sol}) < 10 ε $g{\left({x}_{\mathrm{sol}}\right)}^{\mathrm{T}}g\left({x}_{\mathrm{sol}}\right)<10\epsilon $where T$\mathrm{T}$ denotes transpose, then it is almost certain that x_{sol}${x}_{\mathrm{sol}}$ is a close approximation to the minimum. |
Open in the MATLAB editor: nag_opt_lsq_uncon_quasi_deriv_comp_example
function nag_opt_lsq_uncon_quasi_deriv_comp_example m = int64(15); maxcal = int64(150); eta = 0.9; xtol = 1.05418557512311e-07; x = [0.5; 1; 1.5]; y=[0.14,0.18,0.22,0.25,0.29,0.32,0.35,0.39,0.37,0.58,0.73,0.96,1.34,2.10,4.39]; t = [1.0, 15.0, 1.0; 2.0, 14.0, 2.0; 3.0, 13.0, 3.0; 4.0, 12.0, 4.0; 5.0, 11.0, 5.0; 6.0, 10.0, 6.0; 7.0, 9.0, 7.0; 8.0, 8.0, 8.0; 9.0, 7.0, 7.0; 10.0, 6.0, 6.0; 11.0, 5.0, 5.0; 12.0, 4.0, 4.0; 13.0, 3.0, 3.0; 14.0, 2.0, 2.0; 15.0, 1.0, 1.0]; user = {y; t}; [xOut, fsumsq, fvec, fjac, s, v, niter, nf, user, ifail] = ... nag_opt_lsq_uncon_quasi_deriv_comp(m, ... 'nag_opt_lsq_uncon_quasi_deriv_comp_lsqlin_deriv', ... @lsqfun, @lsqmon, maxcal, eta, xtol, x, 'user', user) function [iflag, fvecc, fjacc, user] = lsqfun(iflag, m, n, xc, ljc, user) y = user{1}; t = user{2}; fvecc = zeros(m, 1); fjacc = zeros(ljc, n); for i = 1:double(m) denom = xc(2)*t(i,2) + xc(3)*t(i,3); fvecc(i) = xc(1) + t(i,1)/denom - y(i); if (iflag ~= 0) fjacc(i,1) = 1; dummy = -1/(denom*denom); fjacc(i,2) = t(i,1)*t(i,2)*dummy; fjacc(i,3) = t(i,1)*t(i,3)*dummy; end end function [user] = lsqmon(m, n, xc, fvecc, fjacc, ljc, s, igrade, niter, nf, user)
xOut = 0.0824 1.1330 2.3437 fsumsq = 0.0082 fvec = -0.0059 -0.0003 0.0003 0.0065 -0.0008 -0.0013 -0.0045 -0.0200 0.0822 -0.0182 -0.0148 -0.0147 -0.0112 -0.0042 0.0068 fjac = 1.0000 -0.0401 -0.0027 1.0000 -0.0663 -0.0095 1.0000 -0.0824 -0.0190 1.0000 -0.0910 -0.0303 1.0000 -0.0941 -0.0428 1.0000 -0.0931 -0.0558 1.0000 -0.0890 -0.0692 1.0000 -0.0827 -0.0827 1.0000 -0.1064 -0.1064 1.0000 -0.1379 -0.1379 1.0000 -0.1820 -0.1820 1.0000 -0.2482 -0.2482 1.0000 -0.3585 -0.3585 1.0000 -0.5791 -0.5791 1.0000 -1.2409 -1.2409 s = 4.0965 1.5950 0.0613 v = -0.9354 0.3530 0.0214 0.2592 0.6432 0.7205 0.2405 0.6795 -0.6932 niter = 6 nf = 7 user = [ 1x15 double] [15x3 double] ifail = 0
Open in the MATLAB editor: e04gb_example
function e04gb_example m = int64(15); maxcal = int64(150); eta = 0.9; xtol = 1.05418557512311e-07; x = [0.5; 1; 1.5]; y=[0.14,0.18,0.22,0.25,0.29,0.32,0.35,0.39,0.37,0.58,0.73,0.96,1.34,2.10,4.39]; t = [1.0, 15.0, 1.0; 2.0, 14.0, 2.0; 3.0, 13.0, 3.0; 4.0, 12.0, 4.0; 5.0, 11.0, 5.0; 6.0, 10.0, 6.0; 7.0, 9.0, 7.0; 8.0, 8.0, 8.0; 9.0, 7.0, 7.0; 10.0, 6.0, 6.0; 11.0, 5.0, 5.0; 12.0, 4.0, 4.0; 13.0, 3.0, 3.0; 14.0, 2.0, 2.0; 15.0, 1.0, 1.0]; user = {y; t}; [xOut, fsumsq, fvec, fjac, s, v, niter, nf, user, ifail] = ... e04gb(m, 'e04hev', @lsqfun, @lsqmon, maxcal, eta, xtol, x, 'user', user) function [iflag, fvecc, fjacc, user] = lsqfun(iflag, m, n, xc, ljc, user) y = user{1}; t = user{2}; fvecc = zeros(m, 1); fjacc = zeros(ljc, n); for i = 1:double(m) denom = xc(2)*t(i,2) + xc(3)*t(i,3); fvecc(i) = xc(1) + t(i,1)/denom - y(i); if (iflag ~= 0) fjacc(i,1) = 1; dummy = -1/(denom*denom); fjacc(i,2) = t(i,1)*t(i,2)*dummy; fjacc(i,3) = t(i,1)*t(i,3)*dummy; end end function [user] = lsqmon(m, n, xc, fvecc, fjacc, ljc, s, igrade, niter, nf, user)
xOut = 0.0824 1.1330 2.3437 fsumsq = 0.0082 fvec = -0.0059 -0.0003 0.0003 0.0065 -0.0008 -0.0013 -0.0045 -0.0200 0.0822 -0.0182 -0.0148 -0.0147 -0.0112 -0.0042 0.0068 fjac = 1.0000 -0.0401 -0.0027 1.0000 -0.0663 -0.0095 1.0000 -0.0824 -0.0190 1.0000 -0.0910 -0.0303 1.0000 -0.0941 -0.0428 1.0000 -0.0931 -0.0558 1.0000 -0.0890 -0.0692 1.0000 -0.0827 -0.0827 1.0000 -0.1064 -0.1064 1.0000 -0.1379 -0.1379 1.0000 -0.1820 -0.1820 1.0000 -0.2482 -0.2482 1.0000 -0.3585 -0.3585 1.0000 -0.5791 -0.5791 1.0000 -1.2409 -1.2409 s = 4.0965 1.5950 0.0613 v = -0.9354 0.3530 0.0214 0.2592 0.6432 0.7205 0.2405 0.6795 -0.6932 niter = 6 nf = 7 user = [ 1x15 double] [15x3 double] ifail = 0