octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40296] Consistent matrix return sizes


From: David Spies
Subject: [Octave-bug-tracker] [bug #40296] Consistent matrix return sizes
Date: Fri, 18 Oct 2013 04:07:09 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?40296>

                 Summary: Consistent matrix return sizes
                 Project: GNU Octave
            Submitted by: dspyz
            Submitted on: Fri 18 Oct 2013 04:07:08 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: dspies
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

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)





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40296>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]