Disable warnings

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Disable warnings

ahowe42
Hello all.

I'm migrating from Matlab to Octave, and trying to work though my code (thousands and thousands of lines) to figure out what needs to be changed to work with octave.  I'm currently wondering how I can disable the "warning: inverse: matrix singular to machine precision" warning I get from running inv().  I have some procedures that run a scalar conversion on a matrix involving inv().  It's ok for me if the matrix is singular, because my scalar value will reflect this.  How can I just turn off the warning?

Just using warning("off",...) doesn't work, because there seems to be no ID for this warning, and I can't look in the source code of inv() because it's compiled.

Thanks for your help.

Andrew
Ubuntu 11.10
Octave 3.4.3 compiled from source
Reply | Threaded
Open this post in threaded view
|

Re: Disable warnings

Jordi Gutiérrez Hermoso-2
On 24 February 2012 04:20, ahowe42 <[hidden email]> wrote:
> I can't look in the source code of inv() because it's compiled.

Come now, this isn't Matlab:

    octave:2> which inv
    `inv' is a function from the file
    /opt/dev-octave/lib/octave/3.6.0/oct/x86_64-unknown-linux-gnu/inv.oct

Aha, it's an oct-file. As explained here,

    http://hg.savannah.gnu.org/hgweb/octave/file/cbcaf5602469/etc/HACKING#l160

we are looking for src/DLD-functions/inv.cc. Which leads us to

    http://hg.savannah.gnu.org/hgweb/octave/file/cbcaf5602469/src/DLD-FUNCTIONS/inv.cc#l218

and indeed, there is no warning ID to disable this warning.

> Octave 3.4.3 compiled from source

So not only do you have the source to inspect, you can *change* it. In
the location showed above. Give it some warning id that you want. Yay,
free software.

You can even submit your change as a patch, and it will be part of a
future Octave release. I do think it would be useful to have a warning
for this id.

Note that you can also just disable all warnings if you want with
warning("off", "all").

HTH,
- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Disable warnings

ahowe42
Ok, I deserved that :-). But seriously thanks a lot Jordi - I'll look into your post, and go from there.  When I'm far enough along the old learning curve, I might very well post a patch.  I would like to contribute.

(I know warning("off","all"), but usually not a great idea to do)...

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Disable warnings

bpabbott
Administrator
In reply to this post by ahowe42
On Feb 24, 2012, at 4:20 AM, ahowe42 wrote:

> Hello all.
>
> I'm migrating from Matlab to Octave, and trying to work though my code
> (thousands and thousands of lines) to figure out what needs to be changed to
> work with octave.  I'm currently wondering how I can disable the "warning:
> inverse: matrix singular to machine precision" warning I get from running
> inv().  I have some procedures that run a scalar conversion on a matrix
> involving inv().  It's ok for me if the matrix is singular, because my
> scalar value will reflect this.  How can I just turn off the warning?
>
> Just using warning("off",...) doesn't work, because there seems to be no ID
> for this warning, and I can't look in the source code of inv() because it's
> compiled.
>
> Thanks for your help.

Did you look at what lastwarn ? Does it return an ID ?

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Disable warnings

monguin61
In reply to this post by Jordi Gutiérrez Hermoso-2
I have a very similar problem with the warning "warning: axis: omitting nonpositive data in log plot" . I'm happy to go into the source to give this warning an ID, but I can't find where it's generated. Can anyone give me some tips on this? I grepped axis.m for "omitting", but it's not in there. Then I grepped all files under /usr/share/octave for "omitting", and still no luck. Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Disable warnings

bpabbott
Administrator
On Jan 24, 2013, at 7:20 PM, monguin61 wrote:

> I have a very similar problem with the warning "warning: axis: omitting
> nonpositive data in log plot" . I'm happy to go into the source to give this
> warning an ID, but I can't find where it's generated. Can anyone give me
> some tips on this? I grepped axis.m for "omitting", but it's not in there.
> Then I grepped all files under /usr/share/octave for "omitting", and still
> no luck. Any ideas?

The warning is given in graphics.cc

        graphics.cc -> axes::properties::calc_tick_sep (double lo, double hi)

For the default branch of the developer's sources, the warning is given on line 5959.

 5957           if ((min_val <= 0 && max_val > 0))
 5958             {
 5959               warning ("axis: omitting non-positive data in log plot");
 5960               min_val = min_pos;
 5961             }

Ben
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave