bugGNU Octave - Bugs: bug #53690, incorrect test in delaunayn?


bug #53690: incorrect test in delaunayn?

Submitted by:  A.R. Burgers <arb>
Submitted on:  Wed 18 Apr 2018 07:38:50 AM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 18 Apr 2018 05:42:02 PM UTC, comment #1: 

This is okay.  See the documentation for the if statement in the Octave manual.

The condition in an if statement is considered true if its value is nonzero, and false if
its value is zero. If the value of the conditional expression in an if statement is a vector or
a matrix, it is considered true only if it is non-empty and all of the elements are nonzero.
The conceptually equivalent code when condition is a matrix is shown below.
if (matrix) ≡ if (all (matrix(:)))

And as an example,

if ([1 0 1])
  disp ("1 0 1 is true");
  disp ("1 0 1 is false");
1 0 1 is false


if ([1 1 1])
  disp ("1 1 1 is true");
  disp ("1 1 1 is false");
1 1 1 is true

Rik <rik5>
Project Administrator
Wed 18 Apr 2018 07:38:50 AM UTC, original submission:  

delaunayn has this code fragment:

    X = pts(T(i,1:end-1),:) - pts(T(i,2:end),:);
    if (abs (det (X)) / sqrt (sumsq (X, 2)) < tol)
      idx(end+1) = i;

in the 2-D case X is a 2x2 matrix, sumsq(X,2) a [2x1] vector, det(X) a scalar.

The "if" is evaluated on a 2x1 vector of logicals. Shouldn't there be an all or any, e.g.:

if all(abs (det (X)) / sqrt (sumsq (X, 2)) < tol))

See also https://savannah.gnu.org/bugs/?53689

A.R. Burgers <arb>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arb (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-18 rik5 StatusNone => Invalid
        Open/ClosedOpen => Closed
        Release4.3.90 => dev

    Back to the top

    Powered by Savane 3.7