What you need to know to use vector subprograms
Increment arguments
The following examples illustrate how to use increment arguments to perform different operations with the same subprogram. These examples use the function F_SDOT with the following usage:
SUBROUTINE | F_SDOT (CONJ, N, ALPHA, X, INCX, BETA, Y, INCY, R) |
INTEGER | CONJ, INCX, INCY, N |
REAL*4 | ALPHA, BETA, R, X(*), Y(*) |
This usage adds the scaled dot product of the vectors X( * ) and Y( * ) to a scaled scalar R.
Example 1
Compute the dot product
R = X(1)*Y(1) + X(2)*Y(2) + X(3)*Y(3) + X(4)*Y(4):
REAL*4 ALPHA,BETA,R,X(*),Y(*)
SUBROUTINE F_SDOT (CONJ, 4, 1.0, X, 1, 0.0, Y, 1)
Example 2
Compute the dot product
T = X(1)*Y(4) + X(2)*Y(3) + X(3)*Y(2) + X(4)*Y(1):
REAL*4 ALPHA,BETA,R,X(*),Y(*)
SUBROUTINE F_SDOT (CONJ, 4, 1.0, X, 1, 0.0, Y,
Example 3
Compute the dot product
Y(2) = A(2,1)*X(1) + A(2,2)*X(2) + A(2,3)*X(3)
This is the dot product of the second row of an
PARAMETER (LDA = 10)
REAL*4 SDOT,A(LDA,3),X(3),Y(LDA)
N = 3
Y(2) = SDOT (N, A(2,1),LDA, X,1)
Operator arguments in the BLAS Standard
Some routines in the BLAS Standard take
Operator arguments used by the BLAS Standard routines are NORM, SORT, SIDE, UPLO, TRANS, CONJ, DIAG, and JROT. Refer to “Operator arguments” on page 25 for explanations of the valid operator values.
36HP MLIB User’s Guide