[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## semantics of sum, prod, cumsum etc.

**From**: |
adler |

**Subject**: |
semantics of sum, prod, cumsum etc. |

**Date**: |
Thu, 22 Nov 2001 19:15:39 -0500 (EST) |

Here is a question I asked previously,
but it was burried in the answer to another,
so it seems to have been overlooked.
I would like to be able to use sum(x,1) to
force column behaviour, even when ncols==1.
I'd like to submit a patch to implement this
behaviour - would it be accepted, or is the
current semantics accepted as correct?
>* For column vectors, the direction parameter of sum*
>* allows control of the direction*
>
>* octave-2.1.34:37> sum( [1 2 3]' )*
>* ans = 6*
>* octave-2.1.34:38> sum( [1 2 3]',1 )*
>* ans = 6*
>* octave-2.1.34:39> sum( [1 2 3]',2 )*
>* ans =*
>* 1*
>* 2*
>* 3*
>
>* However, this is not the case for row vectors.*
>
>* octave-2.1.34:34> sum( [1 2 3] )*
>* ans = 6*
>* octave-2.1.34:35> sum( [1 2 3],1 )*
>* ans = 6*
>* octave-2.1.34:36> sum( [1 2 3],2 )*
>* ans = 6*
>
>* In other words sum(x) == sum(x,1).*
>* There is no way to force column behaviour.*
>
>* Is this a bug?*
_______________________________________
Andy Adler, address@hidden
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------

**Indirect Addressing Question**, *Etienne Grossmann*, `2001/11/14`
**Re: Indirect Addressing Question**, *Mirek Kwasniak*, `2001/11/14`
**Re: Indirect Addressing Question**, *Paul Kienzle*, `2001/11/14`
**overloading functions (Was: Indirect Addressing Question)**, *adler*, `2001/11/15`
**Re: overloading functions (Was: Indirect Addressing Question)**, *Paul Kienzle*, `2001/11/16`
**Re: overloading functions (Was: Indirect Addressing Question)**, *John W. Eaton*, `2001/11/16`
**Re: overloading functions (Was: Indirect Addressing Question)**, *adler*, `2001/11/16`
**Re: overloading functions**, *Paul Kienzle*, `2001/11/20`
**semantics of sum, prod, cumsum etc.**,
*adler* **<=**
**Re: Indirect Addressing Question**, *adler*, `2001/11/15`