changeset 5624:d840500bf70d octave-forge

NaN: weightening of data; fix support for FreeMat v3.6
author schloegl
date Tue, 12 May 2009 16:13:45 +0000
parents 852ca6a071c7
children c4eab3671e06
files extra/NaN/doc/INSTALL extra/NaN/inst/geomean.m extra/NaN/inst/harmmean.m extra/NaN/inst/zscore.m
diffstat 4 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/extra/NaN/doc/INSTALL	Tue May 12 12:51:51 2009 +0000
+++ b/extra/NaN/doc/INSTALL	Tue May 12 16:13:45 2009 +0000
@@ -7,26 +7,26 @@
 	addpath('/your/directory/structure/to/NaN/')
 	path('/your/directory/structure/to/NaN/',path)
    Make sure the functions in the NaN-toolbox are found before the default functions.  
-   	
+	
 c) run NANINSTTEST 
 This checks whether the installation was successful. 
 
 d) [OPTIONAL]: 
-  To improve speed, you can use the MEX-version of SUMSKIPNAN. 
+  For support of weighted statistics, you need the MEX-version of SUMSKIPNAN and COVM. 
   Some precompiled binaries are provided. If your platform is not supported, 
-  compile the C-Mex-function SUMSKIPNAN_MEX.CPP using
+  compile the C-Mex-functions SUMSKIPNAN_MEX.CPP and COVM_MEX.CPP using
     mex sumskipnan_mex.cpp
-  The oct-file sumskipnan_oct.cc is broken, but Octave can also use 
-  the mex-file.  
+    mex covm_mex.cpp
+  or for Octave use the mex-file.
     mkoctfile --mex sumskipnan_mex.cpp
+    mkoctfile --mex covm_mex.cpp
 
   Run NANINSTTEST again to check the stability of the compiled SUMSKIPNAN.  
 
 e) HINT: if SUMSKIPNAN_MEX causes problems, you can savely remove it. 
-Then the (slower) M-file is used. 
 
 
 	$Id$
-	Copyright (c) 2000-2003,2005,2006,2009 by Alois Schloegl <a.schloegl@ieee.org>	
+	Copyright (c) 2000-2003,2005,2006,2009 by Alois Schloegl <a.schloegl@ieee.org>
 	WWW: http://hci.tugraz.at/~schloegl/matlab/NaN/
 
--- a/extra/NaN/inst/geomean.m	Tue May 12 12:51:51 2009 +0000
+++ b/extra/NaN/inst/geomean.m	Tue May 12 16:13:45 2009 +0000
@@ -1,4 +1,4 @@
-function [y] = geomean(x,DIM)
+function [y] = geomean(x,DIM,W)
 % GEOMEAN calculates the geomentric mean of data elements. 
 % 
 % 	y = geomean(x [,DIM [,W]])   is the same as 
@@ -22,7 +22,7 @@
 %
 %    This program is free software; you can redistribute it and/or modify
 %    it under the terms of the GNU General Public License as published by
-%    the Free Software Foundation; either version 2 of the License, or
+%    the Free Software Foundation; either version 3 of the License, or
 %    (at your option) any later version.
 %
 %    This program is distributed in the hope that it will be useful,
@@ -43,8 +43,11 @@
 if nargin<2
         DIM=min(find(size(x)>1));
         if isempty(DIM), DIM=1; end;
+end
+if nargin<3
+	W = [];
 end;
 
-[y, n] = sumskipnan(log(x),DIM);
+[y, n] = sumskipnan(log(x),DIM,W);
 y = exp (y./n);
 
--- a/extra/NaN/inst/harmmean.m	Tue May 12 12:51:51 2009 +0000
+++ b/extra/NaN/inst/harmmean.m	Tue May 12 16:13:45 2009 +0000
@@ -1,4 +1,4 @@
-function [y] = harmmean(x,DIM)
+function [y] = harmmean(x,DIM,W)
 % HARMMEAN calculates the harmonic mean of data elements. 
 % The harmonic mean is the inverse of the mean of the inverse elements.
 % 
@@ -47,7 +47,10 @@
         DIM=min(find(size(x)>1));
         if isempty(DIM), DIM=1; end;
 end;
+if nargin<3
+	W = [];
+end;
 
-[y, n] = sumskipnan(1./x,DIM);
+[y, n] = sumskipnan(1./x,DIM,W);
 y = n./y;
 
--- a/extra/NaN/inst/zscore.m	Tue May 12 12:51:51 2009 +0000
+++ b/extra/NaN/inst/zscore.m	Tue May 12 16:13:45 2009 +0000
@@ -35,9 +35,10 @@
 %    along with this program; If not, see <http://www.gnu.org/licenses/>.
 
 
-%	Copyright (C) 2000-2003 by Alois Schloegl <a.schloegl@ieee.org>	
-%	$Revision$
 %	$Id$
+%	Copyright (C) 2000-2003,2009 by Alois Schloegl <a.schloegl@ieee.org>	
+%       This is part of the NaN-toolbox for Octave and Matlab 
+%       see also: http://hci.tugraz.at/schloegl/matlab/NaN/       
 
 
 if any(size(i)==0); return; end;
@@ -46,7 +47,7 @@
         DIM=[]; 
 end
 if nargin<3
-        w = []; 
+        W = []; 
 end
 if isempty(DIM), 
         DIM=min(find(size(i)>1));