Mercurial > hg > octave-lojdl
changeset 8948:3e161cae0bc6
update cummin, cummax docs
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 10 Mar 2009 12:28:42 +0100 |
parents | 1e4b3149365a |
children | e31d47f2c9bb |
files | src/ChangeLog src/DLD-FUNCTIONS/max.cc |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,7 @@ 2009-03-10 Jaroslav Hajek <highegg@gmail.com> * data.cc (Fsize_equal): Allow single argument call. + * DLD-FUNCTIONS/max.cc (Fcummin, Fcummax): Update docs. 2009-03-09 Benjamin Lindner <lindnerb@users.sourceforge.net>
--- a/src/DLD-FUNCTIONS/max.cc +++ b/src/DLD-FUNCTIONS/max.cc @@ -908,15 +908,18 @@ @cindex Utility Functions\n\ Return the cumulative minimum values. That means, the call\n\ @example\n\ - [@var{w}, @var{iw}] = cummin (@var{x}, @var{dim})\n\ + [w, iw] = cummin (x, dim)\n\ @end example\n\ \n\ @noindent\n\ is equivalent to the following code:\n\ @example\n\ + colons(1:ndims (x)) = @{':'@};\n\ for i = 1:size (x, dim)\n\ - [@var{w}(:,@dots{},i,:,@dots{}), @var{iw}(:,@dots{},i,:,@dots{})] =\ - min(@var{x}(:,@dots{},1:i,:,@dots{}), @var{dim});\n\ + idxw = idxx = colons;\n\ + idxw@{i@} = i; idxx@{i@} = 1:i;\n\ + [w(idxw@{:@}), iw(idxw@{:@})] =\ + min(x(idxx@{:@}), dim);\n\ endfor\n\ @end example\n\ \n\ @@ -936,15 +939,18 @@ @cindex Utility Functions\n\ Return the cumulative maximum values. That means, the call\n\ @example\n\ - [@var{w}, @var{iw}] = cummax (@var{x}, @var{dim})\n\ + [w, iw] = cummax (x, dim)\n\ @end example\n\ \n\ @noindent\n\ is equivalent to the following code:\n\ @example\n\ + colons(1:ndims (x)) = @{':'@};\n\ for i = 1:size (x, dim)\n\ - [@var{w}(:,@dots{},i,:,@dots{}), @var{iw}(:,@dots{},i,:,@dots{})] =\ - max(@var{x}(:,@dots{},1:i,:,@dots{}), @var{dim});\n\ + idxw = idxx = colons;\n\ + idxw@{i@} = i; idxx@{i@} = 1:i;\n\ + [w(idxw@{:@}), iw(idxw@{:@})] =\ + max(x(idxx@{:@}), dim);\n\ endfor\n\ @end example\n\ \n\