Defines | Functions

max.cc File Reference

#include "lo-ieee.h"
#include "lo-mappers.h"
#include "lo-math.h"
#include "dNDArray.h"
#include "CNDArray.h"
#include "quit.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
#include "ov-cx-mat.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
Include dependency graph for max.cc:

Go to the source code of this file.

Defines

#define MAKE_INT_BRANCH(X)
#define MAKE_INT_BRANCH(X)
#define MAKE_INT_BRANCH(X)

Functions

 DEFUN_DLD (min, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} min (@var{x})\n\ @deftypefnx {Loadable Function} {} min (@var{x}, @var{y})\n\ @deftypefnx {Loadable Function} {} min (@var{x}, [], @var{dim})\n\ @deftypefnx {Loadable Function} {} min (@var{x}, @var{y}, @var{dim})\n\ @deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} min (@var{x})\n\ For a vector argument, return the minimum value. For a matrix\n\ argument, return the minimum value from each column, as a row\n\ vector, or over the dimension @var{dim} if defined, in which case @var{y} \n\ should be set to the empty matrix (it's ignored otherwise). For two matrices\n\ (or a matrix and scalar), return the pair-wise minimum.\n\ Thus,\n\ \n\ @example\n\ min (min (@var{x}))\n\ @end example\n\ \n\ @noindent\n\ returns the smallest element of @var{x}, and\n\ \n\ @example\n\ @group\n\ min (2:5, pi)\n\ @result{} 2.0000 3.0000 3.1416 3.1416\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ compares each element of the range @code{2:5} with @code{pi}, and\n\ returns a row vector of the minimum values.\n\ \n\ For complex arguments, the magnitude of the elements are used for\n\ comparison.\n\ \n\ If called with one input and two output arguments,\n\ @code{min} also returns the first index of the\n\ minimum value(s). Thus,\n\ \n\ @example\n\ @group\n\ [x, ix] = min ([1, 3, 0, 2, 0])\n\ @result{} x = 0\n\ ix = 3\n\ @end group\n\ @end example\n\ @seealso{max, cummin, cummax}\n\ @end deftypefn")
 DEFUN_DLD (cummin, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} cummin (@var{x})\n\ @deftypefnx {Loadable Function} {} cummin (@var{x}, @var{dim})\n\ @deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} cummin (@var{x})\n\ Return the cumulative minimum values along dimension @var{dim}. If @var{dim}\n\ is unspecified it defaults to column-wise operation. For example:\n\ \n\ @example\n\ @group\n\ cummin ([5 4 6 2 3 1])\n\ @result{} 5 4 4 2 2 1\n\ @end group\n\ @end example\n\ \n\ \n\ The call\n\ \n\ @example\n\ [w, iw] = cummin (x)\n\ @end example\n\ \n\ @noindent\n\ with @code{x} a vector, is equivalent to the following code:\n\ \n\ @example\n\ @group\n\ w = iw = zeros (size (x));\n\ for i = 1:length (x)\n\ [w(i), iw(i)] = max (x(1:i));\n\ endfor\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ but computed in a much faster manner.\n\ @seealso{cummax, min, max}\n\ @end deftypefn")
 DEFUN_DLD (cummax, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} cummax (@var{x})\n\ @deftypefnx {Loadable Function} {} cummax (@var{x}, @var{dim})\n\ @deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} cummax (@var{x})\n\ Return the cumulative maximum values along dimension @var{dim}. If @var{dim}\n\ is unspecified it defaults to column-wise operation. For example:\n\ \n\ @example\n\ @group\n\ cummax ([1 3 2 6 4 5])\n\ @result{} 1 3 3 6 6 6\n\ @end group\n\ @end example\n\ \n\ The call\n\ \n\ @example\n\ [w, iw] = cummax (x, dim)\n\ @end example\n\ \n\ @noindent\n\ with @code{x} a vector, is equivalent to the following code:\n\ \n\ @example\n\ @group\n\ w = iw = zeros (size (x));\n\ for i = 1:length (x)\n\ [w(i), iw(i)] = max (x(1:i));\n\ endfor\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ but computed in a much faster manner.\n\ @seealso{cummin, max, min}\n\ @end deftypefn")
 DEFUN_DLD (max, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} max (@var{x})\n\ @deftypefnx {Loadable Function} {} max (@var{x}, @var{y})\n\ @deftypefnx {Loadable Function} {} max (@var{x}, [], @var{dim})\n\ @deftypefnx {Loadable Function} {} max (@var{x}, @var{y}, @var{dim})\n\ @deftypefnx {Loadable Function} {[@var{w}, @var{iw}] =} max (@var{x})\n\ For a vector argument, return the maximum value. For a matrix\n\ argument, return the maximum value from each column, as a row\n\ vector, or over the dimension @var{dim} if defined, in which case @var{y} \n\ should be set to the empty matrix (it's ignored otherwise). For two matrices\n\ (or a matrix and scalar), return the pair-wise maximum.\n\ Thus,\n\ \n\ @example\n\ max (max (@var{x}))\n\ @end example\n\ \n\ @noindent\n\ returns the largest element of the matrix @var{x}, and\n\ \n\ @example\n\ @group\n\ max (2:5, pi)\n\ @result{} 3.1416 3.1416 4.0000 5.0000\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ compares each element of the range @code{2:5} with @code{pi}, and\n\ returns a row vector of the maximum values.\n\ \n\ For complex arguments, the magnitude of the elements are used for\n\ comparison.\n\ \n\ If called with one input and two output arguments,\n\ @code{max} also returns the first index of the\n\ maximum value(s). Thus,\n\ \n\ @example\n\ @group\n\ [x, ix] = max ([1, 3, 5, 2, 5])\n\ @result{} x = 5\n\ ix = 3\n\ @end group\n\ @end example\n\ @seealso{min, cummax, cummin}\n\ @end deftypefn")
static octave_value_list do_cumminmax_body (const octave_value_list &args, int nargout, bool ismin)
template<class ArrayType >
static octave_value_list do_cumminmax_red_op (const octave_value &arg, int nargout, int dim, bool ismin)
template<class ArrayType >
static octave_value do_minmax_bin_op (const octave_value &argx, const octave_value &argy, bool ismin)
static octave_value_list do_minmax_body (const octave_value_list &args, int nargout, bool ismin)
template<class ArrayType >
static octave_value_list do_minmax_red_op (const octave_value &arg, int nargout, int dim, bool ismin)
template<>
octave_value_list do_minmax_red_op< boolNDArray > (const octave_value &arg, int nargout, int dim, bool ismin)

Define Documentation

#define MAKE_INT_BRANCH (   X  ) 
Value:
case btyp_ ## X: \
          retval = do_minmax_red_op<X ## NDArray> (arg, nargout, dim, ismin); \
          break;
#define MAKE_INT_BRANCH (   X  ) 
Value:
case btyp_ ## X: \
          retval = do_cumminmax_red_op<X ## NDArray> (arg, nargout, dim, ismin); \
          break;
#define MAKE_INT_BRANCH (   X  ) 
Value:
case btyp_ ## X: \
          retval = do_minmax_bin_op<X ## NDArray> (argx, argy, ismin); \
          break;

Function Documentation

DEFUN_DLD ( min  ,
args  ,
nargout   
)

Definition at line 308 of file max.cc.

References do_minmax_body().

DEFUN_DLD ( cummin  ,
args  ,
nargout   
)

Definition at line 568 of file max.cc.

References do_cumminmax_body().

DEFUN_DLD ( cummax  ,
args  ,
nargout   
)

Definition at line 610 of file max.cc.

References do_cumminmax_body().

DEFUN_DLD ( max  ,
args  ,
nargout   
)

Definition at line 387 of file max.cc.

References do_minmax_body().

static octave_value_list do_cumminmax_body ( const octave_value_list args,
int  nargout,
bool  ismin 
) [static]
template<class ArrayType >
static octave_value_list do_cumminmax_red_op ( const octave_value arg,
int  nargout,
int  dim,
bool  ismin 
) [static]

Definition at line 469 of file max.cc.

References error_state, octave_value(), and octave_value_list::resize().

template<class ArrayType >
static octave_value do_minmax_bin_op ( const octave_value argx,
const octave_value argy,
bool  ismin 
) [static]

Definition at line 110 of file max.cc.

References error_state, octave_value::is_scalar_type(), max(), min(), and x.

static octave_value_list do_minmax_body ( const octave_value_list args,
int  nargout,
bool  ismin 
) [static]
template<class ArrayType >
static octave_value_list do_minmax_red_op ( const octave_value arg,
int  nargout,
int  dim,
bool  ismin 
) [static]

Definition at line 46 of file max.cc.

References error_state, octave_value(), and octave_value_list::resize().

template<>
octave_value_list do_minmax_red_op< boolNDArray > ( const octave_value arg,
int  nargout,
int  dim,
bool  ismin 
)

Referenced by do_minmax_body().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines