## Stata 15 help for mf_subdiagget

```
Title

[M-5] subdiagget() -- Extract matrix subdiagonals

Syntax

transmorphic colvector subdiagget(transmorphic matrix X, real vector
lower, real vector upper)

Description

subdiagget(X) returns subdiagonals of X transformed into a column vector
with one subdiagonal stacked onto the next.

Examples

1.  Extract the subdiagonal of matrix X,

d = subdiagget(X, 1, 0)

2.  Extract the superdiagonal of matrix X,

d = subdiagget(X, 0, 1)

3.  Extract the 1st through 5th subdiagonals of matrix X,

d = subdiagget(X, 1..5, 0)

4.  Extract the 2nd and 4th subdiagonals of matrix X,

d = subdiagget(X, (2,4), 0)

5.  Extract the 4th and 2nd subdiagonals of matrix X,

d = subdiagget(X, (4,2), 0)

Conformability

subdiagget(X):
X:   n x n
result:   p x 1        where p < n

Diagnostics

subdiagget(X) aborts with error if X is not square.

Negative subscripts in lower and upper are treated as positive.

Subscripts greater than or equal to cols(X) in lower and upper are
ignored.

Source code

subdiagget.mata

```