bugGNU Octave - Bugs: bug #36066, number/array fails

 
 

bug #36066: number/array fails

Submitter:  Kris Thielemans <krthie>
Submitted:  Mon 02 Apr 2012 01:40:29 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Kris Thielemans Open/Closed:  * Closed
Release:  * 3.6.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 02 Apr 2012 06:41:38 PM UTC, comment #3: 

So it appears that this really is some aberrant Matlab behaviour. We just tried on a 3.4.1 build, and 1/rand(2,4,3) also errors out.

This looks like a Matlab bug to me, and I don't think we should reproduce it in Octave. I'll mark this bug Won't Fix. If you disagree, we can reconsider this.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Mon 02 Apr 2012 01:53:41 PM UTC, comment #2: 

oh well. I find the following in matlab 2011b

>> 1/ones([3 2])

Error using  /
Matrix dimensions must agree.
 

>> 1/ones([3 2 2])


ans(:,:,1) =

     1     1
     1     1
     1     1


ans(:,:,2) =

     1     1
     1     1
     1     1

That is, you need an nd array... I'm 100% sure that this has worked in matlab since 2006a.

Kris Thielemans <krthie>
Mon 02 Apr 2012 01:48:52 PM UTC, comment #1: 

Are you sure this works in Matlab? I just heard from two sources that it doesn't and errors out (or "crashes", in your language) in the same way that it errors out in Octave.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Mon 02 Apr 2012 01:40:29 PM UTC, original submission:  

I've just upgraded to octave 3.6.1 and find that dividing a number by an array no longer works (it did in 3.4.1):

octave> tmp2=1/ones([3 4 5]);
error: invalid conversion of NDArray to Matrix
octave> tmp2=1/ones([3 4]);
error: operator /: nonconformant arguments (op1 is 1x1, op2 is 3x4)

this does work in matlab though, so my old programs now crash. I wonder if this is unintended behaviour though as this stuff does work with the other operators + - *, for instance

octave> tmp2=1*ones([3 4 5]);

(it doesn't work with ^, but neither does it in matlab)


octave> tmp2=1./ones([3 4 5]);

does still work of course.

Kris Thielemans <krthie>

 

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

Attach Files:
   
   
Comment:
   

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 jordigh (Posted a comment)
  • -email is unavailable- added by krthie (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-04-02 jordigh StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code