Rate This Document
Findability
Accuracy
Completeness
Readability

?spr

Rank 1 update of symmetric expansion matrix, that is, .

Alpha is a multiplication coefficient, x is a vector including n elements, and A is an n x n triangular expansion symmetric matrix.

Interface Definition

C interface:

void cblas_sspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const float *X, const BLASINT incX, float *Ap);

void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const double *X, const BLASINT incX, double *Ap);

Fortran interface:

CALL SSPR(UPLO, N, ALPHA, X, INCX, AP)

CALL DSPR(UPLO, N, ALPHA, X, INCX, 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

Symmetric matrix expansion storage mode (upper triangle expansion or lower triangle expansion)

  • 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 cspr, alpha is of single-precision floating-point type.
  • For zspr, alpha is of double-precision floating-point type.

Multiplication coefficient

Input

X

  • For cspr, X is of single-precision floating-point type.
  • For zspr, X is of double-precision floating point type.

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

Input

incX

Integer

Increase step of vector X. The value cannot be 0.

Input

Ap

For cspr, Ap is of single-precision floating-point type.

For zspr, Ap is of double-precision floating-point type.

Matrix A

Output

Dependencies

#include "kblas.h"

Examples

C interface:

    int n = 3; 
    float alpha = 1.0; 
    int incx = 1; 
    float x[3] = {2.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_sspr(CblasColMajor,CblasLower, n, alpha, x, incx, a); 
    /** 
     *  Output a = |7.0, 5.0, 4.0, 10.0, 5.0, 4.0| 
     */

Fortran interface:

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