Mercurial > hg > octave-nkf
diff scripts/linear-algebra/linsolve.m @ 20448:014e942ac29f stable
linsolve.m: Fix regression when calling linsolve with 2 arguments (bug #45212)
* linsolve.m: Fix regression introduced in cset 91e1da1d1918 when linsolve
is called with 2 arguments. Add %!test for 2-argument form.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Sat, 30 May 2015 15:46:04 -0400 |
parents | 91e1da1d1918 |
children |
line wrap: on
line diff
--- a/scripts/linear-algebra/linsolve.m +++ b/scripts/linear-algebra/linsolve.m @@ -79,12 +79,13 @@ error ("linsolve: A and B must be numeric"); endif + trans_A = false; + ## Process any opts if (nargin > 2) if (! isstruct (opts)) error ("linsolve: OPTS must be a structure"); endif - trans_A = false; if (isfield (opts, "TRANSA") && opts.TRANSA) trans_A = true; endif @@ -119,6 +120,14 @@ %!test %! n = 10; +%! A = rand (n); +%! x = rand (n, 1); +%! b = A * x; +%! assert (linsolve (A, b), A \ b); +%! assert (linsolve (A, b, struct ()), A \ b); + +%!test +%! n = 10; %! A = triu (gallery ("condex", n)); %! x = rand (n, 1); %! b = A' * x;