next up previous index
Next: F122 Search Operations Up: CERNLIB Previous: F118 Rotating a

F121 Vector Algebra

Routine ID: F121
Author(s): M. Aderholz, P.M. NicholsonLibrary: KERNLIB
Submitter: M. AderholzSubmitted: 01.06.1973
Language: Fortran or AssemblerRevised: 16.09.1991

Performs various vector manipulations, such as addition of two vectors, multiplication of a vector by a scalar, scalar product, pre- and post-multiplication of a vector by a matrix.

Structure:

SUBROUTINE, and FUNCTION subprograms
User Entry Names:
VADD, VSUB, VMUL, VBIAS, VSCALE, VLINCO, VUNIT, VMATR,
VMATL, VCOPYN, VFIX, VFLOAT, VFILL, VZERO, VBLANK, VEXCUM,
VDIST, VDIST2, VDOT, VDOTN, VDOTN2, VMOD, VASUM, VSUM,
VMAXA, VMAX, VMINA, VMIN, LVMAXA, LVMAX, LVMINA, LVMIN,
LVSMI, LVSMX, LVSDMI, LVSDMX, LVSIMI, LVSIMX

Notes:

VLINE is the original and obsolete name for the linear combination routine VLINCO; it was changed because it clashed with an entry point in some system library.

Usage:

The arguments in the calling sequences below are defined as follows:

A,B,X
( REAL) One-dimensional arrays of length N.
DA
( DOUBLE PRECISION) One-dimensional array of length N.
IA,IX
( INTEGER) One-dimensional arrays of length N.
C,V
( REAL) One-dimensional arrays of length M.
EX
( REAL) One-dimensional array of length 3.
G
( REAL) Two-dimensional array of dimension (M,N).
ALPHA
( REAL) Variable.
F1,F2
( REAL) Variables.
Y
( REAL) Variable.
N,M
( INTEGER) Variables.
Matrix G is assumed to be stored row-wise, contrary to the Fortran convention, i.e. element Gij is found in word G(J,I) of the memory allocated with DIMENSION G(M,N).

Any summation is taken over the index I from 1 to N or over the index J from 1 to M.

Subroutines
CALL VADD(A,B,X,N)X(I)=A(I)+B(I) (I=1,2,...,N)

CALL VSUB(A,B,X,N)X(I)=A(I)-B(I) (I=1,2,...,N)

CALL VMUL(A,B,X,N)X(I)=A(I)*B(I) (I=1,2,...,N)

CALL VBIAS(A,ALPHA,X,N)X(I)=A(I)+ALPHA (I=1,2,...,N)

CALL VSCALE(A,ALPHA,X,N)X(I)=A(I)*ALPHA (I=1,2,...,N)

CALL VLINCO(A,F1,B,F2,X,N)X(I)=A(I)*F1+B(I)*F2 (I=1,2,...,N)

CALL VUNIT(A,X,N)x = a / |a|

X(I)=A(I)/VMOD(A,N) (I=1,2,...,N)

CALL VMATR(A,G,V,N,M)v = aG

V(J)= ∑ A(I)*G(J,I) (J=1,2,...,M)

CALL VMATL(G,C,X,N,M)x = Gc

X(I)= ∑ G(J,I)*C(J) (I=1,2,...,N)

CALL VCOPYN(A,X,N)X(I)=-A(I) (I=1,2,...,N)

CALL VFIX(A,IX,N)IX(I)=A(I) (I=1,2,...,N)

CALL VFLOAT(IA,X,N)X(I)=IA(I) (I=1,2,...,N)

CALL VFILL(X,N,ALPHA)X(I)=ALPHA (I=1,2,...,N)

CALL VZERO(IX,N)IX(I)=0 (I=1,2,...,N)

CALL VBLANK(IX,N)IX(I)=blank (I=1,2,...,N)

CALL VEXCUM(A,EX,N)EX(1)=min(EX(1),A(1),...,A(N))
EX(2)=max(EX(2),A(1),...,A(N))
EX(3)=EX(3)+∑ A(I)


REAL functions
VDIST2(A,B,N)(a-b)2= ∑ (A(I)-B(I))2

VDIST(A,B,N)|a-b| = (a-b)2

VDOT(A,B,N)ab = ∑ A(I)*B(I)

VDOTN2(A,B,N)(ab)2/ (a2b2)

VDOTN(A,B,N)ab / |a| |b|

VMOD (A,N)|a| = a2

VASUM(A,N)∑ |A(I)|

VSUM (A,N)∑ A(I)

VMAXA(A,N)max(|A(1)|,|A(2)|,...,|A(N)|)

VMAX (A,N)max(A(1),A(2),...,A(N))

VMINA(A,N)min(|A(1)|,|A(2)|,...,|A(N)|)

VMIN (A,N)min(A(1),A(2),...,A(N))


INTEGER functions
LVMAXA(A,N)Location of max|A(I)|

LVMAX (A,N)Location of maxA(I)

LVMINA(A,N)Location of min|A(I)|

LVMIN (A,N)Location of minA(I)

LVSMI(A,N,INC)Location of minA(k)

LVSMX(A,N,INC)Location of maxA(k)

LVSDMI(DA,N,INC)Location of minDA(k)

LVSDMX(DA,N,INC)Location of maxDA(k)

LVSIMI(IA,N,INC)Location of minIA(k)

LVSIMX(IA,N,INC)Location of maxIA(k)


where k=1,1+INC,1+2*INC,...,1+(N-1)*INC


F122



next up previous index
Next: F122 Search Operations Up: CERNLIB Previous: F118 Rotating a


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