DIAG - diagonal
This procedure creates a diagonal matrix from the diagonal elements of the input matrix.
Usage
The DIAG stored procedure has the following syntax:
- DIAG(matrixIn,matrixOut)
- Parameters
- matrixIn
- The name of the input matrix.
- matrixOut
- The name of the output matrix.
Examples
CALL nzm..SHAPE('0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16',4,4 ,'A');
CALL nzm..DIAG('A', 'B');
CALL nzm..PRINT('A');
CALL nzm..PRINT('B');
CALL nzm..DELETE_MATRIX('A');
CALL nzm..DELETE_MATRIX('B');
SHAPE
-------
t
(1 row)
DIAG
------
t
(1 row)
PRINT
-------------------------------------------------------------------
-- matrix: A --0,1,2,3
4, 5, 6, 7
8, 9, 10, 11
12, 13, 14, 15
(1 row)
PRINT
---------------------------------------------------------------
-- matrix: B --
0, 0, 0, 0
0, 5, 0, 0
0, 0, 10, 0
0, 0, 0, 15
(1 row)
DELETE_MATRIX
---------------
t
(1 row)
DELETE_MATRIX
---------------
t
(1 row)