?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)
|
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 |
Y |
|
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 |
|
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|