?syr
Performs a rank-1 update of a symmetric matrix.
That is,
. alpha is a multiplication coefficient, x is a vector including n elements, and A is an n*n symmetric matrix.
Interface Definition
C interface:
void cblas_ssyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const float *X, const BLASINT incX, float *A, const BLASINT lda);
void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const double *X, const BLASINT incX, double *A, const BLASINT lda);
Fortran interface:
CALL SSYR(UPLO, N, ALPHA, X, INCX, A, LDA)
CALL DSYR(UPLO, N, ALPHA, X, INCX, A, LDA)
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 |
Indicates whether to use the upper triangle or lower triangle of matrix A.
|
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 |
A |
|
Matrix A(lda, n). |
Input/Output |
lda |
Integer |
Leading dimension of matrix A. The value of lda must be greater than or equal to max(1, n). |
Input |
Dependency
#include "kblas.h"
Examples
C interface:
int n = 3, lda = 4, incx = 1;
float alpha = 1.0;
float x[3] = {1.0, 3.0, 2.0};
/**
* | 3.0 14.0 12.0 |
* A = | . 16.0 17.0 |
* | . . 13.0 |
* | . . . |
*/
float a[12] = {3.0, 0, 0, 0, 14.0, 16.0, 0, 0, 12, 17.0, 13.0, 0};
cblas_ssyr(CblasColMajor,CblasUpper, n, alpha, x, incx, a, lda);
/**
* | 4.0 17.0 14.0 |
* Output A = | . 25.0 23.0 |
* | . . 17.0 |
* | . . . |
*/
Fortran interface:
INTEGER :: N=3, LDA=4
INTEGER :: INCX=1
REAL(4) :: ALPHA=1.0
REAL(4) :: X(3), A(12)
DATA X/1.0, 3.0, 2.0/
DATA A/3.0, 0, 0, 0, 14.0, 16.0, 0, 0, 12, 17.0, 13.0, 0/
EXTERNAL SSYR
CALL SSYR('U', N, ALPHA, X, INCX, A, LDA)
* | 4.0 17.0 14.0 |
* Output A = | . 25.0 23.0 |
* | . . 17.0 |
* | . . . |