SSYMV/DSYMV/CHEMV/ZHEMV

Matrix-vector multiply

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 the upper triangle of an array A whose dimensions are 10-by-10, 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,LDA,INCX,INCY

 

REAL*4

ALPHA,BETA,A(10,10),X(10),Y(10)

UPLO = ’U’

 

 

N = 9

 

 

ALPHA = 1.0

 

 

BETA = 0.0

 

 

LDA = 10

 

 

INCX = 1

 

 

INCY = 1

 

 

CALL SSYMV (UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)

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

1

--y ρAx , where ρ is a

 

 

2

complex scalar, A is a 9-by-9 complex Hermitian matrix whose lower triangle is stored in the lower triangle of an array A whose dimensions are 10-by-10, 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,LDA

COMPLEX*8 RHO,A(10,10),X(10),Y(10)

N = 9

LDA = 10

CALL CHEMV (’LOWER’,N,-RHO,A,LDA,X,1,(0.5,0.0),Y,1)

274HP MLIB User’s Guide