next up previous index
Next: F003 Elementary Matrix Up: CERNLIB Previous: F001 Linear Algebra

F002 Elementary Vector Processing

Routine ID: F002
Author(s): Library: KERNLIB
Submitter: Submitted: 18.12.1979
Language: Fortran or Assembler or COMPASSRevised: 27.05.1987

These subprograms perform elementary vector operations.

Structure:

SUBROUTINE and FUNCTION subprograms
User Entry Names:
RVADD, RVCPY, RVDIV, RVMPA, RVMPY, RVMUL, RVMULA, RVMUNA,
RVRAN, RVSCA, RVSCL, RVSCS, RVSET, RVSUB, RVSUM, RVXCH,
DVADD, DVCPY, DVDIV, DVMPA, DVMPY, DVMUL, DVMULA, DVMUNA,
DVRAN, DVSCA, DVSCL, DVSCS, DVSET, DVSUB, DVSUM, DVXCH,
CVADD, CVCPY, CVDIV, CVMPA, CVMPY, CVMUL, CVMULA, CVMUNA,
CVRAN, CVSCA, CVSCL, CVSCS, CVSET, CVSUB, CVSUM, CVXCH,
CVMPYC, CVMPAC

External References: LOCF (N100), RANF, DRANF (G900) (some Fortran versions only).

Usage:

For t=R (type REAL), t=D (type DOUBLE PRECISION), t=C (type COMPLEX):
CALL tVSET (N,S,Z1,Z2)zj=s

CALL tVRAN (N,A,B,Z1,Z2)zj= random (see Note2)
CALL tVCPY (N,X1,X2,Z1,Z2)zj=xj

CALL tVXCH (N,X1,X2,Y1,Y2)interchanges xj with yj

CALL tVADD (N,X1,X2,Y1,Y2,Z1,Z2)zj=xj+yj

CALL tVSUB (N,X1,X2,Y1,Y2,Z1,Z2)zj=xj-yj

CALL tVMUL (N,X1,X2,Y1,Y2,Z1,Z2)zj=xjyj

CALL tVMULA(N,X1,X2,Y1,Y2,Z1,Z2)zj=xjyj+zj

CALL tVMUNA(N,X1,X2,Y1,Y2,Z1,Z2)zj=-xjyj+zj

CALL tVDIV (N,X1,X2,Y1,Y2,Z1,Z2,IFAIL)zj=xj/yj (see Note3)
CALL tVSCL (N,S,X1,X2,Z1,Z2)zj=sxj

CALL tVSCA (N,S,X1,X2,Y1,Y2,Z1,Z2)zj=sxj+yj

CALL tVSCS (N,S,X1,X2,Y1,Y2,Z1,Z2)zj=sxj-yj

F = tVSUM (N,X1,X2)f = x1+ ...+xn

F = tVMPY (N,X1,X2,Y1,Y2)f = x1y1+ ...+xnyn

F = tVMPA (N,X1,X2,Y1,Y2,S)f = x1y1+ ...+xnyn+s

F = CVMPYC(N,X1,X2,Y1,Y2)f = x1y1+ ...+xnyn

F = CVMPAC(N,X1,X2,Y1,Y2,S)f = x1y1+ ...+xnyn+s

where yj is the complex conjugate of yj .

N
( INTEGER) The mathematical dimension of the vectors (j = 1,2,...,N) .
S,A,B
(Type according to t) The scalar values s, a, and b, respectively.
X1,X2
(Type according to t) Array elements. They must contain the elements x1,x2 of the vector (xj) .
Y1,Y2
(Type according to t) Array elements. They must contain the elements y1,y2 of the vector (yj) .
Z1,Z2
(Type according to t) Array elements. On exit, they will contain the elements z1,z2 of the result vector (zj) .
IFAIL
( INTEGER) On exit, IFAIL is set to zero if all elements yj are non-zero. Otherwise IFAIL is set to the smallest index k for which yk= 0 .
For N < 1 all subroutines return control without action; functions tVSUM, tVMPY and CVMPYC assume the value zero, and tVMPA and CVMPAC assume the value S.

Restrictions:

If vector (zj) overlaps with vector (xj) or (yj) , results will be correct provided each element zj coincides with an element xk

or yk , where k<j.

Accuracy:

On computers with IBM 370 architecture, RVMPY, RVMPA, CVMPY and CVMPA accumulate the inner product using double-precision arithmetic internally; the final result is then rounded to single precision.

Notes:

  1. The vectors (xj) etc. need not be packed: any equidistant spacing of their elements is permitted. The subprograms determine the location of the vector element xj from the actual arguments X1 and X2.
  2. tVRAN sets zj to a random value of type t that is uniformly distributed in the interval (A,B). For CVRAN, the real and imaginary parts of zj are distributed uniformly and independently in (REAL(A),REAL(B)) and in (AIMAG(A),AIMAG(B)).
  3. If yk= 0 and y1,...,yk-1 are non-zero, tVDIV computes only z1,...,zk-1 and sets IFAIL= k .
  4. The use of an in-line DO loop will be more efficient than calling the equivalent vector processing subprogram when the vector length is sufficiently small, due to the overhead of the subprogram call.
•

F003

H. Lipps



next up previous index
Next: F003 Elementary Matrix Up: CERNLIB Previous: F001 Linear Algebra


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995