octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with eigs


From: Marco Caliari
Subject: Re: Help with eigs
Date: Tue, 8 Jan 2019 08:11:49 +0000

On Mon, 7 Jan 2019 17:35:44 -0500
"John W. Eaton" <address@hidden> wrote:

> On 1/7/19 4:48 PM, Rik wrote:
> > Marco,
> > 
> > I've been working through the static analyzer warnings about the Octave
> > code base and I ran in to a bit of trouble with eigs.
> > 
> > A sample warning is
> > 
> > __eigs__.cc (369) V550     An odd precise comparison: tmp.double_value() !=
> > 0.0. It's probably better to use a comparison with defined precision:
> > fabs(A - B) > Epsilon.
> > 
> > for which the code is
> > 
> > tmp = map.getfield ("cholB");
> > if (tmp.is_defined ())
> >    cholB = tmp.double_value () != 0.0;
> > 
> > Checking the documentation for eigs
> > 
> > 'cholB'
> >       Flag if 'chol (B)' is passed rather than B.  The default is
> >       false.
> > 
> > So, I thought the input was just a true/false and that I could change the
> > code to
> > 
> >    cholB = tmp.bool_value ();
> > 
> > But now when I run the BIST tests I get
> >   
> > octave:1> test eigs  
> > ***** testif HAVE_ARPACK, HAVE_UMFPACK
> >   A = toeplitz (sparse (1:10));
> >   B = toeplitz (sparse ([1, 1], [1, 2], [2, 1], 1, 10));
> >   R = chol (B);
> >   opts.cholB = R;
> >   [v, d] = eigs (A, R, 4, "lm", opts);
> >   for i = 1:4
> >     assert (A * v(:,i), d(i, i) * B * v(:,i), 1e-12)
> >   endfor
> > !!!!! test failed
> > octave_base_value::bool_value(): wrong type argument 'sparse matrix'
> > 
> > If I execute the commands individually I find that opts.cholB is not
> > true/false, but a sparse matrix.  
> 
> It seems wrong to set opts.cholB to the sparse matrix itself here.

Yes, it is wrong.

Marco

reply via email to

[Prev in Thread] Current Thread [Next in Thread]