bugGNU Octave - Bugs: bug #29628, assignment of logical argument is...

 
 

bug #29628: assignment of logical argument is broken

Submitted by:  None
Submitted on:  Wed 21 Apr 2010 02:46:24 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Jaroslav Hajek <highegg>
Originator Name: Alois SchlöglOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
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 23 Apr 2010 09:24:19 AM UTC, comment #2:

Fixed by
http://hg.savannah.gnu.org/hgweb/octave/rev/9961fc022d9d

thanks

Jaroslav Hajek <highegg>In charge of this item.
Wed 21 Apr 2010 04:57:12 PM UTC, comment #1:

This is confirmed on a recent hg tip (fdf28dae0f37, Apr 20th:2010)

Assignments using a null selection have trouble when the rhs side is not of type double.

For example,
-----------------------------------
octave:1> x([]) = single(1)
x = [](0x0)
octave:2> whos
Variables in the current scope:

Attr Name Size Bytes Class
==== ==== ==== ===== =====
ans 1x13 111 cell
x 0x0 0 double

Total is 13 elements using 111 bytes
-----------------------------------

This correctly sets x to [] but fails to set the class correctly to single.

----------------------------------
octave:7> clear x
octave:8> x([]) = logical(1)
x = 0
octave:9> whos
Variables in the current scope:

Attr Name Size Bytes Class
==== ==== ==== ===== =====
ans 1x13 111 cell
x 1x1 1 logical

Total is 14 elements using 112 bytes

----------------------------------

This correctly sets the class to logical but does not initialize the value of x to the null array.

----------------------------------
octave:10> clear x
octave:11> x([]) = char("A")
x =
octave:12> whos
Variables in the current scope:

Attr Name Size Bytes Class
==== ==== ==== ===== =====
ans 1x13 111 cell
x 0x0 0 char

Total is 13 elements using 111 bytes

-----------------------------------

The operator seems to work correctly for the char datatype.

It appears 'single' and 'logical' need some work.

Rik <rik5>
Project Administrator
Wed 21 Apr 2010 02:46:24 PM UTC, original submission:

The assignment to a vector with an empty index list

clear x
x([]) = 0

yields an empty result, which is correct.

x = [](0x0)

However, if the rhs-value is of type logical

clear x
x([]) = logical(0)

the result is a scalar, which is incorrect.

x = 0

This behaviour is inconsistent. Moreover, it breaks also the following command:

x=repmat(logical(0),0,1)

error: reshape: can't reshape 1x1 array to 0x1 array
error: called from:
error: /usr/local/share/octave/3.3.51+/m/general/repmat.m at line 64, column 7

The behavior is observed on 3.2.2 and the 3.3.51+ compiled in the last two days.

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 highegg (Updated the item)
  • -unavailable- added by rik5 (Posted a comment)
  •  

    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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 23 Apr 2010 09:24:19 AM UTChigheggStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 23 Apr 2010 08:03:19 AM UTChigheggAssigned toNone=>highegg
    Wed 21 Apr 2010 04:57:12 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1