bugGNU Octave - Bugs: bug #33219, logical() function does not accept...

 
 

bug #33219: logical() function does not accept integer input scalars

Submitted by:  None
Submitted on:  Tue 03 May 2011 02:19:11 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Performance
Status: FixedAssigned to: None
Originator Name: Jochen WeberOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.4.0
Operating System: Mac OS

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Wed 04 May 2011 06:20:53 PM UTC, comment #8:

I checked in the following change on the stable branch:

http://hg.savannah.gnu.org/hgweb/octave/rev/d3ccd2e37de6

John W. Eaton <jwe>
Project Administrator
Wed 04 May 2011 04:49:55 PM UTC, comment #7:

I've changed the title again to reflect all integer scalars, not just unsigned, are affected.

This is the third recent bug report where array operations work correctly, but scalar operations do not. See, for example, bug #33197 with sortrows on a scalar and bug #33218 with transpose on scalar structs

Rik <rik5>
Project Administrator
Wed 04 May 2011 04:38:04 PM UTC, comment #6:

Yes, indeed, it's only for scalars (but then again, I put that in the title of the bug report ;)

/jochen

Jochen Weber <jweber>
Wed 04 May 2011 04:11:20 PM UTC, comment #5:

I think it's almost narrowed down. I believe the problem is only with scalar values, not array values. Could Jordi or Jochen verify that the following works:

Rik <rik5>
Project Administrator
Wed 04 May 2011 11:54:48 AM UTC, comment #4:

No, it's not a platform-dependent issue. I'm able to confirm on Debian that Jochen's "logical(uint32(5))" example errors out.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Wed 04 May 2011 04:52:43 AM UTC, comment #3:

I modified the summary field to have the dependency on MacOS. Hopefully one of the other developers who use the MacOS platform will be able to help. For reference, this works correctly on a Linux system (Kubuntu 10.04).

Rik <rik5>
Project Administrator
Wed 04 May 2011 02:30:32 AM UTC, comment #2:

This might be a platform dependent bug?

On my Octave 3.4.0 on Mac OSX I get:

Jochen Weber <jweber>
Wed 04 May 2011 01:46:58 AM UTC, comment #1:

I think there may be a different issue here. The following code shows logical() working correctly on uint32 arrays.

Perhaps you could post the file that, when read, is causing the problem and also the exact bit of code which reproduces the error.

Rik <rik5>
Project Administrator
Tue 03 May 2011 02:19:11 PM UTC, original submission:

Given that I'm writing code that reads/writes diverse file formats, some of them contain parameter values stored as 32-bit (unsigned) integers, which yet can only ever have values 0 (false) and 1 (true), which I then internally want to handle as such (logical value).

Matlab accepts the following syntax, which fails in Octave:

A workaround is simple (but definitely seems run-time inefficient on first glance):

or alternatively (not tested, but guessing this works also)

Given that I use a function that interprets a text file containing the information about the parameters to read/write from/to each file (depending on the file format), I definitely wouldn't want to use the second construction as my general syntax, as this would potentially require a large amount of extra memory in case the read content is a large array of type uint8 or so.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by jweber (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 04 May 2011 06:20:53 PM UTCjweStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 04 May 2011 04:49:55 PM UTCrik5Summarylogical() function does not accept unsigned integer input scalars=>logical() function does not accept integer input scalars
    Wed 04 May 2011 04:11:20 PM UTCrik5StatusNeed Info=>Confirmed
    Wed 04 May 2011 11:54:48 AM UTCjordighSummarylogical() function does not accept (unsigned) integer input on MacOS=>logical() function does not accept unsigned integer input scalars
    Wed 04 May 2011 04:52:43 AM UTCrik5Summarylogical() function does not accept (unsigned) integer input=>logical() function does not accept (unsigned) integer input on MacOS
    Wed 04 May 2011 01:46:58 AM UTCrik5StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1