bugGNU Octave - Bugs: bug #40296, Consistent matrix return sizes

 
 

bug #40296: Consistent matrix return sizes

Submitted by:  David Spies <dspyz>
Submitted on:  Fri 18 Oct 2013 04:07:08 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Feature Request
Status: NoneAssigned to: None
Originator Name: dspiesOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Fri 18 Oct 2013 04:07:08 AM UTC, original submission:

Can there be a flag which removes all special cases in matrix return sizes?

In other words, if I say v = A(b), where b is a logical vector, the return type will always be a column vector, regardless of the dimensions of A (instead of being a row vector when A has vertical dimension 1).

Additionally, if v = A(i) where i is a double matrix/vector, v will always have the same dimensions as i, regardless of the dimension of A (instead of being a row vector when i has horiz. dimension 1 and v has vert. dimension 1)

And the find method, [i,j,v] = find(m) will always return column vectors for i, j, and v, even if m is a row vector.

When I'm trying to write Octave functions, I keep on having to deal with these special cases and they don't seem like they should be necessary.

For instance, if I write
[i,j] = find(m);
inds = [i,j]';

for b = inds
r = inds(1)
c = inds(2)
# Do something with r and c
endfor

This fails when m is a row vector, because i and j are made into row vectors and then inds ends up being a 2nx1 column vector instead of 2xn matrix as expected

It would be nice if I could turn off all these special case behaviors (even if it's not matlab compatible)

David Spies <dspyz>

 

(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 dspyz (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):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup