__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