changeset 10495:53e8ab2ec234 octave-forge

(none)
author abarth93
date Sun, 24 Jun 2012 10:34:56 +0000
parents 36b7ef603936
children a72f33b20149
files extra/ncArray/inst/@BaseArray/max.m extra/ncArray/inst/@BaseArray/min.m extra/ncArray/inst/@BaseArray/sum.m extra/ncArray/inst/test_ncarray.m
diffstat 4 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extra/ncArray/inst/@BaseArray/max.m	Sun Jun 24 10:34:56 2012 +0000
@@ -0,0 +1,13 @@
+% s = max (x, [], dim)
+% compute the maximum along dimension dim
+% See also
+%   max
+
+function s = max(self,B,varargin)
+
+assert(isempty(B))
+
+funred = @max;
+funelem = @(x) x;
+
+s = reduce(self,funred,funelem,varargin{:});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extra/ncArray/inst/@BaseArray/min.m	Sun Jun 24 10:34:56 2012 +0000
@@ -0,0 +1,13 @@
+% s = min (x, [], dim)
+% compute the minimum along dimension dim
+% See also
+%   min
+
+function s = min(self,B,varargin)
+
+assert(isempty(B))
+
+funred = @min;
+funelem = @(x) x;
+
+s = reduce(self,funred,funelem,varargin{:});
--- a/extra/ncArray/inst/@BaseArray/sum.m	Sun Jun 24 10:26:23 2012 +0000
+++ b/extra/ncArray/inst/@BaseArray/sum.m	Sun Jun 24 10:34:56 2012 +0000
@@ -1,4 +1,4 @@
-% s = sum (X, DIM)
+% s = sum (x, dim)
 % compute the sum along dimension dim
 % See also
 %   sum
--- a/extra/ncArray/inst/test_ncarray.m	Sun Jun 24 10:26:23 2012 +0000
+++ b/extra/ncArray/inst/test_ncarray.m	Sun Jun 24 10:34:56 2012 +0000
@@ -132,6 +132,14 @@
 stdSSTref = std(SST_ref,[],2);
 assert(isequalwithequalnans(stdSST, stdSSTref))
 
+maxSST = max(SST,[],2);
+maxSSTref = max(SST_ref,[],2);
+assert(isequalwithequalnans(maxSST, maxSSTref))
+
+minSST = min(SST,[],2);
+minSSTref = min(SST_ref,[],2);
+assert(isequalwithequalnans(minSST, minSSTref))
+
 
 % writing