changeset 31881:95e06f13fde3

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 03 Mar 2023 10:11:36 +0100
parents fc40c78a8421 (current diff) b8205aa00a05 (diff)
children 3bdfda4f7c16
files
diffstat 2 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/sparse/bicg.m	Thu Mar 02 22:02:25 2023 -0500
+++ b/scripts/sparse/bicg.m	Fri Mar 03 10:11:36 2023 +0100
@@ -546,3 +546,16 @@
 %! ## b has two columns!
 %! [y, flag]  = bicg (M1 \ A / M2, [M1 \ b, M2' \ b], [], 1);
 %! assert (x, M2 \ y, 8 * eps);
+
+%!test <*63860>
+%! ## additional input argument
+%! n = 10;
+%! s = 1e-3;
+%! tol = 1e-6;
+%! a = ones (n, 1);
+%! a = a / norm (a);
+%! y = zeros (n, 1);
+%! y(1:2:n) = 1;
+%! Amat = @(x, type, s) x + (s * a) * (a' * x);
+%! [x, flag] = bicg (Amat, y, tol, [], [], [], y, s);
+%! assert (y, Amat (x, [], s), tol * norm (y));
--- a/scripts/sparse/private/__alltohandles__.m	Thu Mar 02 22:02:25 2023 -0500
+++ b/scripts/sparse/private/__alltohandles__.m	Fri Mar 03 10:11:36 2023 +0100
@@ -80,8 +80,8 @@
         ## methods which do not require the transpose
         M1fcn = @(x) x;
       case {"bicg"}
-        ## methods which do require the transpose
-        M1fcn = @(x, ~) x;
+        ## methods allow a variable number of arguments
+        M1fcn = @(x, varargin) x;
       otherwise
         error (["__alltohandles__: unknown method: ", solver_name]);
     endswitch
@@ -103,8 +103,8 @@
         ## methods which do not require the transpose
         M2fcn = @(x) x;
       case {"bicg"}
-        ## methods which do require the transpose
-        M2fcn = @(x, ~) x;
+        ## methods allow a variable number of arguments
+        M2fcn = @(x, varargin) x;
       otherwise
         error (["__alltohandles__: unknown method: ", solver_name]);
     endswitch
@@ -133,15 +133,16 @@
         M2fcn = @(x) M2 \ x;
       endif
     case {"bicg"}
-      ## methods which do require the transpose
+      ## methods which require the transpose and allow a variable number of
+      ## arguments
       if (A_is_numeric)
-        Afcn = @(x, trans) A_sub (A, x, trans);
+        Afcn = @(x, trans, varargin) A_sub (A, x, trans);
       endif
       if (M1_is_numeric)
-        M1fcn = @(x, trans) M_sub (M1, x, trans);
+        M1fcn = @(x, trans, varargin) M_sub (M1, x, trans);
       endif
       if (M2_is_numeric)
-        M2fcn = @(x, trans) M_sub (M2, x, trans);
+        M2fcn = @(x, trans, varargin) M_sub (M2, x, trans);
       endif
     otherwise
       error (["__alltohandles__: unknown method: ", solver_name]);