On Fri, Feb 20, 2009 at 10:59 AM, Jussi Leinonen <[email protected]> wrote:
> To: [email protected]
> Cc: [email protected]
> Subject: Function mean() fails with a complex matrix
> --------
> Bug report for Octave 3.0.1 configured for i486-pc-linux-gnu
>
> Description:
> -----------
>
> There seems to be a bug (hopefully not a "feature"!) that causes
> mean() to fail when given a complex matrix as an argument.
>
> Repeat-By:
> ---------
>
> octave:43> c = [1 1+i 2-i];
> octave:44> mean(c)
> error: octave_base_value::array_value(): wrong type argument complex
> matrix'
> error: sumskipnan: first input argument must be a real matrix
> error: evaluating if command near line 72, column 1
> error: called from mean' in file
> /usr/share/octave/packages/nan-1.0.6/mean.m'
>
> Fix:
> ---
>
> Apparently the problem is in the function sumskipnan(), which should
> be edited to support complex numbers (it is not documented that it
> does not), or alternatively, mean() could be implemented differently.
>

Hi,
bug reports for OctaveForge packages should be reported to its mailing list
<[email protected]>.

The NaN-aware mean is relatively easy to simulate:
mask = isnan (x);
x(mask) = 0;
m = sum(x) ./ sum (! mask);

regards

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to