From bug-request at octave dot org Thu Dec 2 08:48:26 2004 Subject: Re: bug beetwen sum and mean From: David Bateman To: Etienne de Foras Cc: bug-octave at octave dot org Date: Thu, 2 Dec 2004 15:45:44 +0100 This was all fixed up in 2.1.58... What I see in 2.1.63 is octave:1> d = rand(1,5); mean(d,1) ans = 0.770339 0.859878 0.806091 0.027545 0.843879 octave:2> sum(d,1) ans = 0.770339 0.859878 0.806091 0.027545 0.843879 Regards David Daprès Etienne de Foras (le 02/12/2004): > Hello, > > First, thanks for this very nice software!!! > > This bug concerne the calculus of mean along a dimension, it may be not consitent with sum: > the result given on a vector line, by mean(...,1) does not have the same dimension with sum(...,1) > > just trying this: > > d=rand(1,5); mean(d,1) > gives: > > dim=1 ans= 0.522 (or an other value) > > and > sum(d,1) > gives > ans= 0.23 0.56 0.14 0.7 0.6 > > Normally sum and mean shall return vectors with the same dimensions. > I think that sum is OK since I explicitely wanted the sum along dimension 1, there is one row so > its return the same vector. > For mean, its force the calculus along dimension 2, this is not what I asked ( for this I would > just give no dimension or 2) , it shall return the same vector (like sum). > > I am using this function to avoid this bug (and other for center, std, studentize...): > > function mn=vector_mean(a) > if rows(a)<2 > # disp('using simplified mean') > mn=a; > return; > endif; > mn=mean(a); > endfunction > > But of course, it would be preferable to modify mean.m itself . > > By the way center, std, and studentize may be concerned too . > > Thanks and see you... > > PS : version= 2.1.50 on win32 > > > > > > > Vous manquez d’espace pour stocker vos mails ? > Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! > Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ > > Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com > > > > ------------------------------------------------------------- > 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 > ------------------------------------------------------------- -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- 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 -------------------------------------------------------------