MTX_POW - nth power of a matrix
This procedure multiplies a matrix n times.
Usage
The MTX_POW stored procedure has the following syntax:
- MTX_POW(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
Implements the operation C := A ** n, where n is a natural number and A and C are matrices.
Matrix A must be a square matrix. Matrix C must not exist prior to the operation.
Note: For larger
exponents use the mtx_pow2 procedure, which is optimized for quicker calculation.
Examples
CALL nzm..shape('1,2,3,4,5,0,6,7,8',3,3,'A');
CALL nzm..mtx_pow('A',6,'B');
CALL nzm..print('B');
CALL nzm..delete_matrix('A');
CALL nzm..delete_matrix('B');
SHAPE
-------
t
(1 row)
MTX_POW
---------
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)