From 0d89f5bff1fe5bbe792340bb94600bcf0d42ce53 Mon Sep 17 00:00:00 2001 From: Jeffrey Larson Date: Wed, 12 Jun 2024 12:11:25 -0500 Subject: [PATCH 1/2] Typo in docs --- pounders/py/formquad.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pounders/py/formquad.py b/pounders/py/formquad.py index 2299fc57..731a097a 100644 --- a/pounders/py/formquad.py +++ b/pounders/py/formquad.py @@ -9,7 +9,7 @@ def formquad(X, F, delta, xk_in, np_max, Pars, vf): """ - formquad(X, F, delta, xk_in, np_max, Pars, vf) -> [Mdir, np, valid, G, H, Mind] + formquad(X, F, delta, xk_in, np_max, Pars, vf) -> [Mdir, mp, valid, G, H, Mind] Computes the parameters for m quadratics ### FIX COMMENT Line 15 ### Q_i(x) = C(i) + G(:,i)'*x + 0.5*x'*H(:,:,i)*x, i=1:m @@ -31,7 +31,7 @@ def formquad(X, F, delta, xk_in, np_max, Pars, vf): vf [log] Flag indicating you just want to check model validity --OUTPUTS---------------------------------------------------------------- Mdir [dbl] [(n-np+1)-by-n] Unit directions to improve model - np [int] Number of interpolation points (=length(Mind)) + mp [int] Number of interpolation points (=length(Mind)) valid [log] Flag saying if model is valid within Pars[2]*delta G [dbl] [n-by-m] Matrix of model gradients centered at X[xkin] H [dbl] [n-by-n-by-m] Array of model Hessians centered at X[xkin] From 2f8c36863128ae99b16f53d8057e7ae205e6ac93 Mon Sep 17 00:00:00 2001 From: Jeffrey Larson Date: Wed, 12 Jun 2024 13:43:40 -0500 Subject: [PATCH 2/2] Showing a possible solution --- pounders/py/pounders.py | 3 +++ pounders/py/tests/test_showing_error_on_row10.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pounders/py/pounders.py b/pounders/py/pounders.py index 0feba490..1dd2cd83 100644 --- a/pounders/py/pounders.py +++ b/pounders/py/pounders.py @@ -342,6 +342,9 @@ def pounders(Ffun, X_0, n, nf_max, g_tol, delta_0, m, Low, Upp, Prior=None, Opti D = X[: nf + 1] - X[xk_in] Res[: nf + 1, :] = (F[: nf + 1, :] - Cres) - np.diagonal(0.5 * D @ (np.tensordot(D, Hres, axes=1))).T [_, _, valid, Gres, Hresdel, Mind] = formquad(X[: nf + 1, :], Res[: nf + 1, :], delta, xk_in, Model["np_max"], Model["Par"], False) + if Hresdel.shape != Hres.shape: + X, F, hF, flag = prepare_outputs_before_return(X, F, hF, nf, -5) + return X, F, hF, flag, xk_in Hres = Hres + Hresdel # Update for modelimp; Cres unchanged b/c xk_in unchanged G, H = combinemodels(Cres, Gres, Hres) diff --git a/pounders/py/tests/test_showing_error_on_row10.py b/pounders/py/tests/test_showing_error_on_row10.py index fbd460db..a05d93eb 100644 --- a/pounders/py/tests/test_showing_error_on_row10.py +++ b/pounders/py/tests/test_showing_error_on_row10.py @@ -59,5 +59,3 @@ def Ffun(y): if flag == 0: assert evals <= nf_max + nfs, "POUNDERs evaluated more than nf_max evaluations" - elif flag != -4: - assert evals == nf_max + nfs, "POUNDERs didn't use nf_max evaluations"