help-octave
[Top][All Lists]
Advanced

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

## shape of x(y)

 From: John W. Eaton Subject: shape of x(y) Date: Tue, 1 Aug 2000 21:15:07 -0500 (CDT)

```On  1-Aug-2000, Andy Adler <address@hidden> wrote:

| I'm trying to figure out the rules
| octave uses for index expressions of type: x(y)
|
| They seems to be quite complicated, this
| is what I could figure out.
|
|   x is matrix: result is same shape as y
|   x is vector: result is same orientation as x
|   x is scalar: result is column orientation
|
| Is this correct?

Close, but in the last case, Octave actually uses the value of
prefer_column_vectors to decide whether to create a row or column
vector.  But that will likely change, since now I see it is not
compatible with Matlab, even if prefer_column_vectors is set to 0.

| I need to know so that I can
| make the sparse functions do the same thing
| as the current "full" matrix rules.
|
| Additionally, I find these rules unecessarily
| complicated. Wouln't a rule like:
|   result is same shape as y
| work in all cases?

No, because then I don't think it would be compatible with Matlab.  It
appears that Matlab now returns

x is matrix: result is same shape as y
x is vector: result is same orientation as x
x is scalar: result is same shape as y

| Or this this another example of bug-for-bug
| MATLAB compatibility?

Maybe, only it seems it is no longer compatible either (I thought that
it once was, at least if prefer_column_vectors was set to 0).

jwe

-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]
• shape of x(y), Andy Adler, 2000/08/01
• shape of x(y), John W. Eaton <=