Navigation

Operators and Keywords

Function List:

C++ API

tril.cc File Reference

#include <algorithm>
#include "Array.h"
#include "Sparse.h"
#include "mx-base.h"
#include "ov.h"
#include "Cell.h"
#include "defun-dld.h"
#include "error.h"
#include "oct-obj.h"
Include dependency graph for tril.cc:

Defines

#define ARRAYCASE(TYP)

Functions

 DEFUN_DLD (tril, args,,"-*- texinfo -*-\n\ @deftypefn {Function File} {} tril (@var{A})\n\ @deftypefnx {Function File} {} tril (@var{A}, @var{k})\n\ @deftypefnx {Function File} {} tril (@var{A}, @var{k}, @var{pack})\n\ @deftypefnx {Function File} {} triu (@var{A})\n\ @deftypefnx {Function File} {} triu (@var{A}, @var{k})\n\ @deftypefnx {Function File} {} triu (@var{A}, @var{k}, @var{pack})\n\ Return a new matrix formed by extracting the lower (@code{tril})\n\ or upper (@code{triu}) triangular part of the matrix @var{A}, and\n\ setting all other elements to zero. The second argument is optional,\n\ and specifies how many diagonals above or below the main diagonal should\n\ also be set to zero.\n\ \n\ The default value of @var{k} is zero, so that @code{triu} and\n\ @code{tril} normally include the main diagonal as part of the result.\n\ \n\ If the value of @var{k} is negative, additional elements above (for\n\ @code{tril}) or below (for @code{triu}) the main diagonal are also\n\ selected.\n\ \n\ The absolute value of @var{k} must not be greater than the number of\n\ sub-diagonals or super-diagonals.\n\ \n\ For example:\n\ \n\ @example\n\ @group\n\ tril (ones (3), -1)\n\ @result{} 0 0 0\n\ 1 0 0\n\ 1 1 0\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ and\n\ \n\ @example\n\ @group\n\ tril (ones (3), 1)\n\ @result{} 1 1 0\n\ 1 1 1\n\ 1 1 1\n\ @end group\n\ @end example\n\ \n\ If the option \"pack\" is given as third argument, the extracted elements\n\ are not inserted into a matrix, but rather stacked column-wise one above\n\ other.\n\ @seealso{triu, diag}\n\ @end deftypefn")
 DEFUN_DLD (triu, args,,"-*- texinfo -*-\n\ @deftypefn {Function File} {} triu (@var{A})\n\ @deftypefnx {Function File} {} triu (@var{A}, @var{k})\n\ @deftypefnx {Function File} {} triu (@var{A}, @var{k}, @var{pack})\n\ @xref{tril}.\n\ @end deftypefn")

Define Documentation

#define ARRAYCASE (   TYP  ) 
Value:
case btyp_ ## TYP: \
              retval = do_trilu (arg.TYP ## _array_value (), k, lower, pack); \
              break

Function Documentation

DEFUN_DLD ( tril  ,
args   
)
DEFUN_DLD ( triu  ,
args   
)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines