octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, a


From: Lachlan Andrew
Subject: [Octave-bug-tracker] [bug #43098] "if (array)" should raise a warning, and give the same result for dense and sparse
Date: Sat, 25 Jun 2016 14:18:18 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #14, bug #43098 (project octave):

Thanks for the feedback, Colin and Rik.  Each iteration I'm learning more
about Octave :)

The new patch omits the brackets and spaces.  Calling X||0 does execute the
same code (is_true()) as if(...).  The patch is to warn of the use of matrices
as boolean values in all contexts: while, until, if, &&, || so I see each as
being as explicit as another.  However, I suppose the bug report was about
"if" only.

It now uses octave::math::isnan -- I didn't know about it before.

The sparse<bool> is now a specialization.

Another change that wasn't requested is in "is_equal" in ov.cc.  That is used
in things like switch statements.  To avoid the warning, I now explicitly take
"all()" before "is_true()", but have to reshape it so that all() captures all
dimensions.  The alternative would be to have an argument to  is_true()  that
requests that the warning be suppressed.  I'm not sure which would be more
efficient.

(file #37574)
    _______________________________________________________

Additional Item Attachment:

File name: bug_43098_warn_if_array.v5.cset Size:11 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43098>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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