## bug #40296: Consistent matrix return sizes

 Submitted by: David Spies Submitted on: Fri 18 Oct 2013 04:07:08 AM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: Feature Request Status: None Assigned to: None Originator Name: dspies Open/Closed: Open Release: dev Operating System: Any

You are not logged in

Tue 08 Dec 2015 10:21:07 AM UTC, comment #1:

I agree this would be convenient, however I don't think it would be sufficiently useful to justify the code bloat.

If someone posted a patch on Savannah but it was not applied to the main code base, could this request be closed?

Lachlan Andrew <lachlan>
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 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 lachlan (Posted a comment)
• -email is unavailable- added by dspyz (Submitted the item)
•

Do you think this task is very important?
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):