Mercurial > hg > octave-lojdl
changeset 9593:cf8403208c43
Fix nesting error in options parsing of eigs
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 01 Sep 2009 08:15:59 +0200 |
parents | 5828d64ca004 |
children | 01004c3cde2c |
files | src/ChangeLog src/DLD-FUNCTIONS/eigs.cc |
diffstat | 2 files changed, 31 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-09-01 David Bateman <dbateman@free.fr> + + * DLD-FUNCTIONS/eig.cc (Feigs): Correct nesting error in option + parsing that prevented the use of a function for generalized + eigenvalue problems. + 2009-08-30 Jaroslav Hajek <highegg@gmail.com> * ops.h (DEFCMPLXCMPOP_OP, DEFNDCMPLXCMPOP_FN): New macros.
--- a/src/DLD-FUNCTIONS/eigs.cc +++ b/src/DLD-FUNCTIONS/eigs.cc @@ -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