From: <aba...@us...> - 2012-07-05 13:39:34
|
Revision: 10730 http://octave.svn.sourceforge.net/octave/?rev=10730&view=rev Author: abarth93 Date: 2012-07-05 13:39:24 +0000 (Thu, 05 Jul 2012) Log Message: ----------- Modified Paths: -------------- trunk/octave-forge/extra/ncArray/inst/@BaseArray/BaseArray.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/end.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/max.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/mean.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/min.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/numel.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/prod.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/reduce.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/size.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/std.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/sum.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/sumsq.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/var.m trunk/octave-forge/extra/ncArray/inst/nccoord.m Added Paths: ----------- trunk/octave-forge/extra/ncArray/inst/@BaseArray/isnumeric.m trunk/octave-forge/extra/ncArray/inst/@BaseArray/moment.m Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/BaseArray.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/BaseArray.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/BaseArray.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,4 +1,4 @@ -% create a BaseArray of size size sz +% Create a BaseArray of size sz. % sz has at least two elements. function retval = BaseArray(sz) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/end.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/end.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/end.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,3 +1,5 @@ +% Return last index along a dimension. + function e = end(self,k,n) e = size(self,k); Added: trunk/octave-forge/extra/ncArray/inst/@BaseArray/isnumeric.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/isnumeric.m (rev 0) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/isnumeric.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -0,0 +1,22 @@ +% Test if array is numeric. +% isn = isnumeric(self) + +function isn = isnumeric(self) +isn = true; + + +% Copyright (C) 2012 Alexander Barth <bar...@gm...> +% +% 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 +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; If not, see <http://www.gnu.org/licenses/>. + Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/max.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/max.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/max.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,6 @@ -% s = max (x, [], dim) -% compute the maximum along dimension dim -% See also -% max +% Compute the maximum. +% S = max (X, [], DIM) +% Compute the maximum along dimension DIM. function s = max(self,B,varargin) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/mean.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/mean.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/mean.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,7 @@ +% Compute the mean. % s = mean (X, DIM) -% compute the mean along dimension dim -% See also -% mean +% Compute the mean along dimension DIM. + function s = mean(self,varargin) funred = @plus; Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/min.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/min.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/min.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,6 @@ -% s = min (x, [], dim) -% compute the minimum along dimension dim -% See also -% min +% Compute the minimum. +% S = min (X, [], DIM) +% Compute the minimum along dimension DIM. function s = min(self,B,varargin) Added: trunk/octave-forge/extra/ncArray/inst/@BaseArray/moment.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/moment.m (rev 0) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/moment.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -0,0 +1,36 @@ +% Compute the central moment. +% M = moment (X, ORDER, DIM) +% compute the central moment of the given order along dimension DIM. + +function s = moment(self,order,varargin) + +m = mean(self,varargin{:}); + +funred = @plus; +funelem = @(x) (x-m).^order; + +[s,n] = reduce(self,funred,funelem,varargin{:}); + +if isempty(s) + s = NaN; +else + s = s/n; +end + + + +% Copyright (C) 2012 Alexander Barth <bar...@gm...> +% +% 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 +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; If not, see <http://www.gnu.org/licenses/>. + Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/numel.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/numel.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/numel.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,3 +1,6 @@ +% Number of elements. +% n = numel(A) + function n = numel(self) n = prod(self.sz); Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/prod.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/prod.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/prod.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,3 +1,6 @@ +% Compute the product. +% P = prod (X, DIM) +% Compute the product of all elements along dimension DIM. function s = prod(self,varargin) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/reduce.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/reduce.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/reduce.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,6 +1,7 @@ -% [s,n] = reduce(self,funred,funelem,dim) -% reduce array using the function funred applied to all elements -% after the function funelem was applied along dimension dim +% Reduce array using callback fundtions. +% [S,N] = reduce(SELF,FUNRED,FUNELEM,DIM) +% reduce array using the function FUNRED applied to all elements +% after the function FUNELEM was applied along dimension DIM. function [s,n] = reduce(self,funred,funelem,dim) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/size.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/size.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/size.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,3 +1,6 @@ +% Size of array. +% sz = size(self,dim) + function sz = size(self,dim) sz = self.sz; Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/std.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/std.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/std.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,6 @@ -% s = std (X, OPT, DIM) -% compute the standard deviation -% See also -% std +% Compute the standard deviation. +% S = std (X, OPT, DIM) + function s = std(self,varargin) s = sqrt(var(self,varargin{:})); Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/sum.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/sum.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/sum.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,6 @@ -% s = sum (x, dim) -% compute the sum along dimension dim -% See also -% sum +% Compute the sum. +% S = sum (X, DIM) +% Compute the sum along dimension DIM. function s = sum(self,varargin) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/sumsq.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/sumsq.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/sumsq.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,6 @@ -% s = sumsq (x, dim) -% compute the sum squared along dimension dim -% See also -% sum +% Compute the sum squared. +% S = sumsq (X, DIM) +% Compute the sum squared along dimension DIM. function s = sumsq(self,varargin) Modified: trunk/octave-forge/extra/ncArray/inst/@BaseArray/var.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/@BaseArray/var.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/@BaseArray/var.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,7 +1,7 @@ -% s = var (x, opt, dim) -% compute the variance along dimension dim -% See also -% var +% Compute the variance. +% V = var (X, OPT, DIM) +% Compute the variance along dimension DIM. +% If OPT is equal to 1, then the variance is bias-corrected. function s = var(self,opt,varargin) Modified: trunk/octave-forge/extra/ncArray/inst/nccoord.m =================================================================== --- trunk/octave-forge/extra/ncArray/inst/nccoord.m 2012-07-05 13:13:20 UTC (rev 10729) +++ trunk/octave-forge/extra/ncArray/inst/nccoord.m 2012-07-05 13:39:24 UTC (rev 10730) @@ -1,4 +1,4 @@ -% Coordinate of a NetCDF variable. +% Coordinates of a NetCDF variable. % % coord = nccoord(filename,varname) % get coordinates of the variable varname in the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |