Mercurial > hg > octave-avbm
changeset 13796:53674ceb9133
maint: fix function definition in test
* bicg.m: Use function block to define funciton for test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 02 Nov 2011 23:28:22 -0400 |
parents | 5b395217ccb9 |
children | 718f78b01de1 |
files | scripts/sparse/bicg.m |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/sparse/bicg.m +++ b/scripts/sparse/bicg.m @@ -222,6 +222,16 @@ %! [x, flag, relres, iter, resvec] = bicg (A, b, tol, maxit, M1, M2); %! assert (x, ones (size (b)), 1e-7); %! + +%!function y = afun (x, t, a) +%! switch t +%! case "notransp" +%! y = a * x; +%! case "transp" +%! y = a' * x; +%! endswitch +%!endfunction +%! %!test %! n = 100; %! A = spdiags ([-2*ones(n,1) 4*ones(n,1) -ones(n,1)], -1:1, n, n); @@ -231,15 +241,6 @@ %! M1 = spdiags ([ones(n,1)/(-2) ones(n,1)],-1:0, n, n); %! M2 = spdiags ([4*ones(n,1) -ones(n,1)], 0:1, n, n); %! -%! function y = afun (x, t, a) -%! switch t -%! case "notransp" -%! y = a * x; -%! case "transp" -%! y = a' * x; -%! endswitch -%! endfunction -%! %! [x, flag, relres, iter, resvec] = bicg (@(x, t) afun (x, t, A), %! b, tol, maxit, M1, M2); %! assert (x, ones (size (b)), 1e-7);