MTX_POW2 - nth power of a matrix
This procedure, optimized for larger exponent values, multiplies a matrix n times.
Usage
The MTX_POW2 stored procedure has the following syntax:
- MTX_POW2(matrixAname,n,matrixCname)
- Parameters
- matrixAname
- The name of input matrix A.
- n
- The power used to raise the matrix.
- matrixCname
- The name of output matrix C.
Details
This procedure, like MTX_POW, implements the operation C := A ** n, where n is a natural number and A and C are matrices. However, this procedure is optimized for larger exponents. Matrix A must be a square matrix. Matrix C must not exist prior to the operation.
Examples
CALL nzm..shape('1,2,3,4,5,0,6,7,8',3,3,'A');
CALL nzm..mtx_pow2('A',6,'B');
CALL nzm..print('B');
CALL nzm..delete_matrix('A');
CALL nzm..delete_matrix('B');
SHAPE
-------
t
(1 row)
MTX_POW2
----------
t
(1 row)
PRINT
------------------------------------------------------------------
-- matrix: B --
488907, 624285, 431775
306552, 391737, 269148
1491562, 1904635, 1316950
(1 row)
DELETE_MATRIX
---------------
t
(1 row)
DELETE_MATRIX
---------------
t
(1 row)