{S,D}SPR2 (uplo, n, alpha, x, incx, y, incy, ap) {C,Z}HPR2 (uplo, n, alpha, x, incx, y, incy, ap)
uplo character*1 On entry, specifies whether the upper- or lower- triangular part of the matrix A is supplied in the packed array AP: If uplo = 'U' or 'u', the upper-triangular part of matrix A is supplied. If uplo = 'L' or 'l', the lower-triangular part of matrix A is supplied. On exit, uplo is unchanged. n integer*4 On entry, the order of the matrix A; n >= 0. On exit, n is unchanged. alpha real*4 | real*8 | complex*8 | complex*16 On entry, the scalar alpha*. On exit, alpha is unchanged. x real*4 | real*8 | complex*8 | complex*16 On entry, a one-dimensional array X of length at least (1+(n-1)*|incx|). Array X contains the vector x. On exit, x is unchanged. incx integer*4 On entry, the increment for the elements of X; incx must not equal zero. On exit, incx is unchanged. y real*4 | real*8 | complex*8 | complex*16 On entry, a one-dimensional array Y of length at least (1+(n-1)*|incy|). The incremented array Y must contain the vector y. On exit, y is unchanged. incy integer*4 On entry, the increment for the elements of Y; incy must not equal zero. On exit, incy is unchanged. ap real*4 | real*8 | complex*8 | complex*16 On entry, a one-dimensional array AP of length at least n(n + 1)/2. If uplo specifies the upper triangular part of the matrix A, the array contains those elements of the matrix, packed sequentially, column by column, so that AP(1) contains a(11), AP(2) and AP(3) contain a(12) and a(22) respectively, and so on. If uplo specifies the lower triangular part to the matrix A, the array contains those elements of the matrix, also packed sequentially, so that AP(1) contains a(11), AP(2) and AP(3) contain a(21) and a(31) respectively, and so on. For CHPR2 and ZHPR2 routines, the imaginary parts of the diagonal elements are not accessed, need not be set, and are assumed to be zero. On exit, ap is overwritten by the specified part of the updated matrix.
SSPR2 and DSPR2 perform the rank-two update of a real symmetric matrix stored in packed form: A = alpha*x*transp(y) + alpha*y*transp(x) + A CHPR2 and ZHPR2 perform the rank-two update of a complex Hermitian matrix stored in packed form: A = alpha*x*conjug_transp(y) + conjugate(alpha)*y*conjug_transp(x) + A alpha is a scalar, x is vector with n elements, and A is an n by n matrix in packed form. In the case of SSPR2 and DSPR2, matrix A is a symmetric matrix and in the case of CHPR2 and ZHPR2, matrix A is a Hermitian matrix.
REAL*4 AP(250), X(20), Y(20), alpha INCX = 1 INCY = 1 alpha = 2.0 N = 20 CALL SSPR2('L',N,alpha,X,INCX,Y,INCY,AP) This FORTRAN code computes the rank-2 update of a real symmetric matrix A, given by A = alpha*x*transp(y) + alpha*y*transp(x) + A. A is a real symmetric matrix, of order 20, with its lower-triangular part stored in packed form in AP.