bugGNU Octave - Bugs: bug #55445, (minor) Boolean matrix sometimes...


bug #55445: (minor) Boolean matrix sometimes becomes double upon assigning zeros:

Submitted by:  Dave Goel <deego>
Submitted on:  Fri 11 Jan 2019 12:07:37 PM UTC  
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  deego Open/Closed:  Closed
Release:  4.2.2 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

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


Fri 11 Jan 2019 01:57:13 PM UTC, comment #1:

This problem has already been reported (bug #53007) and was fixed in Octave 4.4.0. If possible you should upgrade to that version or wait for your Linux distributor to provide a more recent version of Octave.

Kai Torben Ohlhus <siko1056>
Project Member
Fri 11 Jan 2019 12:07:37 PM UTC, original submission:

Normally, if I boolmatrix(indices)=0, octave infers that I really meant false when I said 0, and it keeps the matrix boolean. You may now go on do things like bar(boolmatrix)=k, and assume that octave will do a (faster version) of bar(find(boolmatrix))=k.

But, this fails for some edge cases, leading to (hard-to-track!) bugs:


b = [false false]
b(indices)=0 ## where indices are [], [1], [2], [1 2], etc.
class (b) ## => logical

b = [false]
b(indices)=0 ## for any choice of indices: [], [1]
class (b) ## => double

Finally, if b were an empty bool matrix, it continues to stay bool matrix. The problem seems to be limited to the 1-element case.

A similar switch doesn't seem to happen if I assign a(1)=<double> where a is a uint8 matrix with only one element, and a stays uint8.

(I should learn to stop using 0/1 for false/true).

Dave Goel <deego>


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

Attach Files:

No files currently attached


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by deego (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-01-11 siko1056 Dependencies- => Depends on bugs #53007
    2019-01-11 siko1056 Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        Item GroupOther => Incorrect Result
        StatusNone => Duplicate
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.4