From bug-request at octave dot org Thu Dec 2 08:26:22 2004 Subject: bug beetwen sum and mean From: Etienne de Foras To: bug-octave at octave dot org Date: Thu, 2 Dec 2004 06:31:22 -0600 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 -------------------------------------------------------------