DIAG Function
Makes a diagonal array or extracts the diagonal of an array.
Usage
d = DIAG( a )
Input Parameters
a — An array.
Returned Value
d — If a is one-dimensional then d is the n-dimensional diagonal array with diagonal a; otherwise, d is the diagonal of a.
Keywords
n — The dimensionality of d when a is one-dimensional. (Default: 2)
Example
a = DIAG( [1,1,1] )
PM, a
; PV-WAVE prints:
; 1 0 0
; 0 1 0
; 0 0 1
PM, DIAG( a )
; PV-WAVE prints:
; 1
; 1
; 1