?spr
Perform a rank-1 update of a symmetric expanded matrix.
That is,
. alpha is a multiplication coefficient, x is a vector including n elements, and A is an n*n triangular expanded 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 |
Whether the matrix is in row- or column-major order. |
Input |
Uplo |
Enumeration type CBLAS_UPLO |
Indicates the expansion storage mode of the symmetric matrix (upper triangle or lower triangle).
|
Input |
N |
Integer |
Number of elements in vector X. |
Input |
alpha |
|
Multiplication coefficient. |
Input |
X |
|
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 |
Ap |
Single-precision floating-point type for sspr Double-precision floating-point type for dspr |
Matrix A. |
Output |
Dependency
#include "kblas.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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|