Matrix-vector multiply

 

SSPMV/DSPMV/CHPMV/ZHPMV

Output

y

The updated y vector replaces the input.

Notes These subprograms conform to specifications of the Level 2 BLAS.

If an error in the arguments is detected, the subprograms call error handler XERBLA, which writes an error message onto the standard error file and terminates execution. The standard version of XERBLA (refer to the end of this chapter) can be replaced with a user-supplied version to change the error procedure. Error conditions are:

uplo ≠ ’L’ or ’l’ or ’U’ or ’u’ n < 0

incx = 0 incy = 0

Actual character arguments in a subroutine call may be longer than the corresponding dummy arguments. Therefore, readability of the CALL statement may be improved by coding the uplo argument as ’LOWER’ for ’L’ or ’UPPER’ for ’U’. Refer to “Example 2.”

Example 1 Form the REAL*4 matrix-vector product y = Ax, where A is a 9-by-9 real symmetric matrix whose upper triangle is stored in packed form in an array AP of dimension 55, x is a real vector 9 elements long stored in an array X of dimension 10, and y is a real vector 9 elements long stored in an array Y, also of dimension 10.

CHARACTER*1 UPLO

 

 

 

 

INTEGER*4

N,INCX,INCY

 

 

 

 

REAL*4

ALPHA,BETA,AP(55),X(10),Y(10)

 

 

 

UPLO = ’U’

 

 

 

 

 

N = 9

 

 

 

 

 

ALPHA = 1.0

 

 

 

 

 

BETA = 0.0

 

 

 

 

 

INCX = 1

 

 

 

 

 

INCY = 1

 

 

 

 

 

CALL SSPMV (UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)

 

 

Example 2 Form the COMPLEX*8 matrix-vector product y =

1

, where

ρ

is a

-- y ρAx

 

 

 

2

 

 

 

complex scalar, A is a 9-by-9 complex Hermitian matrix whose lower triangle is stored in packed form in an array AP of dimension 55, x is a complex vector 9 elements long stored in an array X of dimension 10, and y is a complex vector 9 elements long stored in an array Y, also of dimension 10.

INTEGER*4 N

COMPLEX*8 RHO,AP(55),X(10),Y(10)

N = 9

CALL CHPMV (’LOWER’,N,-RHO,AP,X,1,(0.5E0,0.0E0),Y,1)

Chapter 3 Basic Matrix Operations 253