# HG changeset patch # User David Bateman # Date 1251971038 -7200 # Node ID 92b5580c014514034586d4a7eac69e94b406084d # Parent c781fb52c1d78c5ca016b33465066f45eab3818f Fix nesting error in options parsing of eigs diff -r c781fb52c1d7 -r 92b5580c0145 src/ChangeLog --- a/src/ChangeLog Tue Sep 01 09:35:17 2009 +0200 +++ b/src/ChangeLog Thu Sep 03 11:43:58 2009 +0200 @@ -1,3 +1,9 @@ +2008-09-01 David Bateman + + * DLD-FUNCTIONS/eig.cc (Feigs): Correct nesting error in option + parsing that prevented the use of a function for generalized + eigenvalue problems. + 2009-09-01 Jaroslav Hajek * ov-class.cc (get_current_method_class): Check before slicing. diff -r c781fb52c1d7 -r 92b5580c0145 src/DLD-FUNCTIONS/eigs.cc --- a/src/DLD-FUNCTIONS/eigs.cc Tue Sep 01 09:35:17 2009 +0200 +++ b/src/DLD-FUNCTIONS/eigs.cc Thu Sep 03 11:43:58 2009 +0200 @@ -425,25 +425,27 @@ } } - // Note hold off reading B till later to avoid issues of double - // copies of the matrix if B is full/real while A is complex.. - if (!error_state && nargin > 1 && !(args(1).is_real_scalar ())) + } + + // Note hold off reading B till later to avoid issues of double + // copies of the matrix if B is full/real while A is complex.. + if (!error_state && nargin > 1 + arg_offset && + !(args(1 + arg_offset).is_real_scalar ())) + { + if (args(1+arg_offset).is_complex_type ()) { - if (args(1).is_complex_type ()) - { - b_arg = 1+arg_offset; - have_b = true; - bmat = 'G'; - b_is_complex = true; - arg_offset++; - } - else - { - b_arg = 1+arg_offset; - have_b = true; - bmat = 'G'; - arg_offset++; - } + b_arg = 1+arg_offset; + have_b = true; + bmat = 'G'; + b_is_complex = true; + arg_offset++; + } + else + { + b_arg = 1+arg_offset; + have_b = true; + bmat = 'G'; + arg_offset++; } } @@ -834,6 +836,11 @@ %! d1 = eigs (fn, n, k, 4.1, opts); %! assert (d1, eigs(A,k,4.1), 1e-11); %!testif HAVE_ARPACK +%! AA = speye (10); +%! fn = @(x) A * x; +%! opts.issym = 1; opts.isreal = 1; +%! assert (eigs (fn, 10, AA, 3, 'lm', opts), [1; 1; 1]); +%!testif HAVE_ARPACK %! [v1,d1] = eigs(A, k, 'lm'); %! d1 = diag(d1); %! for i=1:k