bugGNU Octave - Bugs: bug #35589, Incorrect behavior of vertical...

 
 

bug #35589: Incorrect behavior of vertical concatenation array operator in >2 dimensions

Submitter:  Nir Krakauer <nir_krakauer>
Submitted:  Wed 22 Feb 2012 07:24:19 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Nir Krakauer Open/Closed:  * Closed
Release:  * 3.4.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 22 Feb 2012 07:33:00 PM UTC, comment #1: 

This is an old bug (bug #32683) that has already been fixed.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 22 Feb 2012 07:24:19 PM UTC, original submission:  

cat gives the correct vertical concatenation behavior for N-D arrays. For example,

A = cat(1, ones(1, 5, 2), 2*ones(1, 5, 2))

returns

A =

ans(:,:,1) =

   1   1   1   1   1
   2   2   2   2   2

ans(:,:,2) =

   1   1   1   1   1
   2   2   2   2   2


However, using a semicolon, which should be equivalent to cat(1, ..) according to the manual and which does work in 2-D, leads to garbage:

A = [ones(1, 5, 2); 2*ones(1, 5, 2)]
A =

ans(:,:,1) =

    2.0000e+00    2.0000e+00    2.0000e+00    2.0000e+00    2.0000e+00
   2.6744e-316   2.4173e-316   2.4189e-316   2.4072e-316   2.3905e-316

ans(:,:,2) =

    2.0000e+00    2.0000e+00    2.0000e+00    2.0000e+00    2.0000e+00
   2.4189e-316   2.4190e-316   2.4190e-316   2.4190e-316   2.4190e-316

(The exact garbage returned changes from call to call.)

On the other hand, using the comma for concatenation along the second dimension gives the same results as cat(2, ..), as expected.

Nir Krakauer <nir_krakauer>

 

(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 nir_krakauer (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-02-22 jordigh StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code