comparison scripts/general/tril.m @ 3426:f8dde1807dee

[project @ 2000-01-13 08:40:00 by jwe]
author jwe
date Thu, 13 Jan 2000 08:40:53 +0000
parents ae7adbb591e8
children 434790acb067
comparison
equal deleted inserted replaced
3425:8625164a0a39 3426:f8dde1807dee
23 ## Return a new matrix formed by extracting extract the lower (@code{tril}) 23 ## Return a new matrix formed by extracting extract the lower (@code{tril})
24 ## or upper (@code{triu}) triangular part of the matrix @var{a}, and 24 ## or upper (@code{triu}) triangular part of the matrix @var{a}, and
25 ## setting all other elements to zero. The second argument is optional, 25 ## setting all other elements to zero. The second argument is optional,
26 ## and specifies how many diagonals above or below the main diagonal should 26 ## and specifies how many diagonals above or below the main diagonal should
27 ## also be set to zero. 27 ## also be set to zero.
28 ## 28 ##
29 ## The default value of @var{k} is zero, so that @code{triu} and 29 ## The default value of @var{k} is zero, so that @code{triu} and
30 ## @code{tril} normally include the main diagonal as part of the result 30 ## @code{tril} normally include the main diagonal as part of the result
31 ## matrix. 31 ## matrix.
32 ## 32 ##
33 ## If the value of @var{k} is negative, additional elements above (for 33 ## If the value of @var{k} is negative, additional elements above (for
34 ## @code{tril}) or below (for @code{triu}) the main diagonal are also 34 ## @code{tril}) or below (for @code{triu}) the main diagonal are also
35 ## selected. 35 ## selected.
36 ## 36 ##
37 ## The absolute value of @var{k} must not be greater than the number of 37 ## The absolute value of @var{k} must not be greater than the number of
38 ## sub- or super-diagonals. 38 ## sub- or super-diagonals.
39 ## 39 ##
40 ## For example, 40 ## For example,
41 ## 41 ##
42 ## @example 42 ## @example
43 ## @group 43 ## @group
44 ## tril (ones (3), -1) 44 ## tril (ones (3), -1)
45 ## @result{} 0 0 0 45 ## @result{} 0 0 0
46 ## 1 0 0 46 ## 1 0 0
47 ## 1 1 0 47 ## 1 1 0
48 ## @end group 48 ## @end group
49 ## @end example 49 ## @end example
50 ## 50 ##
51 ## @noindent 51 ## @noindent
52 ## and 52 ## and
53 ## 53 ##
54 ## @example 54 ## @example
55 ## @group 55 ## @group
56 ## tril (ones (3), 1) 56 ## tril (ones (3), 1)
57 ## @result{} 1 1 0 57 ## @result{} 1 1 0
58 ## 1 1 1 58 ## 1 1 1