Evaluates a real general matrix polynomial.
A — N by N matrix for which the polynomial is to be computed. (Input)
COEF — Vector of length NCOEF containing the coefficients of the polynomial in order of increasing power. (Input)
B — N by N matrix containing the value of the polynomial evaluated at A. (Output)
N — Order of the
matrix A.
(Input)
Default: N = size
(A,1).
LDA — Leading
dimension of A
exactly as specified in the dimension statement of the calling
program. (Input)
Default: LDA = size
(A,1).
NCOEF — Number of
coefficients. (Input)
Default: NCOEF = size
(COEF,1).
LDB — Leading
dimension of B
exactly as specified in the dimension statement of the calling
program. (Input)
Default: LDB = size
(B,1).
Generic: CALL POLRG (A, COEF, B [,…])
Specific: The specific interface names are S_POLRG and D_POLRG.
Single: CALL POLRG (N, A, LDA, NCOEF, COEF, B, LDB)
Double: The double precision name is DPOLRG.
Let m = NCOEF and c = COEF.
The routine POLRG computes the matrix polynomial
using Horner's scheme
where I is the N ´ N identity matrix.
Workspace may be explicitly provided, if desired, by use of P2LRG/DP2LRG. The reference is
CALL P2LRG (N, A, LDA, NCOEF, COEF, B, LDB, WORK)
The additional argument is
WORK — Work vector of length N * N.
This example evaluates the matrix polynomial 3I + A + 2A2, where A is a 3 ´ 3 matrix.
USE POLRG_INT
USE WRRRN_INT
IMPLICIT NONE
! Declare variables
INTEGER LDA, LDB, N, NCOEF
PARAMETER (N=3, NCOEF=3, LDA=N, LDB=N)
!
REAL A(LDA,N), B(LDB,N), COEF(NCOEF)
! Set values of A and COEF
!
! A = ( 1.0 3.0 2.0 )
! ( -5.0 1.0 7.0 )
! ( 1.0 5.0 -4.0 )
!
! COEF = (3.0, 1.0, 2.0)
!
DATA A/1.0, -5.0, 1.0, 3.0, 1.0, 5.0, 2.0, 7.0, -4.0/
DATA COEF/3.0, 1.0, 2.0/
!
! Evaluate B = 3I + A + 2*A**2
CALL POLRG (A, COEF, B)
! Print B
CALL WRRRN ('B = 3I + A + 2*A**2', B)
END
B = 3I + A +
2*A**2
1 2
3
1 -20.0 35.0
32.0
2 -11.0 46.0
-55.0
3 -55.0 -19.0 105.0
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |