FNLMath : Introduction : Using Operators and Generic Functions
Using Operators and Generic Functions
For users who are primarily interested in easy-to-use software for numerical linear algebra, see Chapter 10, “Linear Algebra Operators and Generic Functions”. This compact notation for writing Fortran 90 programs, when it applies, results in code that is easier to read and maintain than traditional subprogram usage.
Users may begin their code development using operators and generic functions. If a more efficient executable code is required, a user may need to switch to equivalent subroutine calls using IMSL Fortran Numerical Library routines.
Table 2 and Table 3 contain lists of the defined operators and some of their generic functions.
Table 2 — Defined Operators and Generic Functions for Dense Arrays
Defined Array Operation
Matrix Operation
A .x. B
AB
.i. A
A-1
.t. A, .h. A
AT,A*
A .ix. B
A-1B
B .xi. A
BA-1
A .tx. B, or (.t. A) .x. B
A .hx. B, or (.h. A) .x. B
ATB,A*B
B .xt. A, or B .x. (.t. A)
B .xh. A, or B .x. (.h. A)
BAT,BA*
S=SVD(A [,U=U, V=V])
A = USVT
E=EIG(A [[,B=B, D=D], V=V, W=W])
(AV = VE), AVD = BVE, (AW = WE), AWD = BWE
R=CHOL(A)
A = RTR
Q=ORTH(A [,R=R])
(A = QR),QTQ = I
U=UNIT(A)
[u1,] = [a1/a1,]
F=DET(A)
det(A) = determinant
K=RANK(A)
rank(A) = rank
P=NORM(A[,[type=]i])
C=COND(A)
Z=EYE(N)
Z = IN
A=DIAG(X)
A = diag(x1,)
X=DIAGONALS(A)
x = (x11,)
W=FFT(Z); Z=IFFT(W)
Discrete Fourier Transform, Inverse
A=RAND(A)
random numbers, 0 < A < 1
L=isNaN(A)
test for NaN, if (l) then
Table 3 — Defined Operators and Generic Functions for Harwell-Boeing Sparse Matrices
Defined Operation
Matrix Operation
Data Management
Define entries of sparse matrices
A .x. B
AB
.t. A, .h. A
AT,A*
A .ix. B
A-1B
B .xi. A
BA-1
A .tx. B, or (.t. A) .x. B
A .hx. B, or (.h. A) .x. B
ATB,A*B
B .xt. A, or B .x. (.t. A)
B .xh. A, or B .x. (.h. A)
BAT,BA*
A+B
Sum of two sparse matrices
C=COND(A)