[OctDev] Function mean() fails with a complex matrix

Alois Schlögl alois.schloegl at tugraz.at
Thu Mar 5 03:35:27 CST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jaroslav Hajek wrote:
> On Thu, Mar 5, 2009 at 9:31 AM, Alois Schlögl <alois.schloegl at tugraz.at> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>> I was digging in my old files and found the attached version of
>> sumskipnan for an oct-file. It considers complex numbers, but fails at
>> line 198, which should combine he real and the imaginary part in one
>> complex matrix. Has anyone a clue how to do this in the correct way ?
>>
>> Alois
>>
> 
> Is this function really needed? I mean, stuff like "nansum" can easily
> be implemented using something like.
> 
> x(isnan(x)) = 0;
> y = sum(x,dim)

> 
> True, this will make a copy of the matrix, but is that so painful?


sumskipnan counts also the number of non-NaNs.
[s,c]=sumskipnan(...)

computing both s and c in a single step is beneficial for estimating
mean, variance and other statistics.


> 
> Besides, I think the fact that the NaN package shadows Octave's
> built-in functions is very dangerous and confusing, even though I
> understand the motivation. I think this package should not be
> installed by default.


Where do you see a danger ? Please explain.

Cheers,
  Alois


> 
> cheers
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmvnNwACgkQzSlbmAlvEIhv6gCdEtL++JiM9m1lfn+oF0kgsVuo
mTQAnjifyYPuc1zU1Pt2N8bNFGxME63v
=E5Kw
-----END PGP SIGNATURE-----


More information about the Bug-octave mailing list