Rate This Document
Findability
Accuracy
Completeness
Readability

?spr2

Perform a rank-2 update of a symmetric expansion matrix, that is, .

alpha is a multiplication coefficient, x and y are vectors including n elements, and A is an n x n triangular expansion symmetric matrix.

Interface Definition

C interface:

void cblas_sspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const float *X, const BLASINT incX, const float *Y, const BLASINT incY, float *A);

void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const double *X, const BLASINT incX, const double *Y, const BLASINT incY, double *A);

Fortran interface:

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

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

Parameters

Parameter

Type

Description

Input/Output

order

Enumeration type CBLAS_ORDER

Indicates whether the matrix is in row- or column-major order.

Input

Uplo

Enumeration type CBLAS_UPLO

Expansion storage mode of a symmetric matrix (upper triangle or lower triangle)

  • If Uplo = CblasUpper, the upper triangle of A is used for expansion.
  • If Uplo = CblasLower, the lower triangle of A is used for expansion.

Input

N

Integer

Number of elements in vector X

Input

alpha

  • For sspr2, alpha is of single-precision complex number type.
  • For dspr2, alpha is of double-precision complex number type.

Multiplication coefficient

Input

X

  • For sspr2, X is of single-precision complex number type.
  • For dspr2, X is of double-precision complex number type.

Matrix X. The length must be at least 1+(n-1)*abs(incX).

Input

incX

Integer

Increment for elements in vector X. The value cannot be 0.

Input

Y

  • For sspr2, Y is of single-precision complex number type.
  • For dspr2, Y is of double-precision complex number type.

Matrix Y. The length must be at least 1+(n-1)*abs(incY).

Input

incY

Integer

Increment for elements in vector Y. The value cannot be 0.

Input

A

  • For sspr2, A is of single-precision complex number type.
  • For dspr2, A is of double-precision complex number type.

Triangle storage of matrix A

Input/Output

Dependencies

#include "kblas.h"

Examples

C interface:

    float alpha = 1.0; 
    int n = 3, incx = 1, incy = 1; 
    float x[3] = {2.0, 2.0, 1.0}; 
    float y[3] = {1.0, 2.0, 1.0}; 
    /** 
     *             | 3.0  1.0  2.0 | 
     *         A = | 1.0  6.0  3.0 | 
     *             | 2.0  3.0  3.0 | 
     */ 
    float a[6] = {3.0, 1.0, 2.0, 6.0, 3.0, 3.0}; 
 
    cblas_sspr2(CblasColMajor,CblasLower, n, alpha, x, incx, y, incy, a); 
    /** 
     *  Output a = |7.0, 7.0, 5.0, 14.0, 7.0, 5.0| 
     */

Fortran interface:

      REAL(4) :: ALPHA=1.0 
      INTEGER :: N=3 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      REAL(4) :: X(3), Y(3), A(6) 
      DATA X/2.0, 2.0, 1.0/ 
      DATA Y/1.0, 2.0, 1.0/ 
      DATA A/3.0, 1.0, 2.0, 6.0, 3.0, 3.0/ 
      EXTERNAL SSPR2 
      CALL SSPR2('L', N, ALPHA, X, INCX, Y, INCX, A) 
 
*     Output A = |7.0, 7.0, 5.0, 14.0, 7.0, 5.0|