?her
Hermitian matrix rank 1 update,
.
A is an n x n Hermitian matrix, alpha is a multiplication coefficient, and x is a vector with n elements.
Interface Definition
C interface:
void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const void *X, const BLASINT incX, void *A, const BLASINT lda);
void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const void *X, const BLASINT incX, void *A, const BLASINT lda);
Fortran interface:
CALL CHER(UPLO, N, ALPHA, X, INCX, A, LDA)
CALL ZHER(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 |
Storage mode of the Hermitian 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 |
Increase step of vector X. The value cannot be 0. |
Input |
A |
|
Matrix A(lda, n) |
Output |
lda |
Integer |
Length of the main dimension of matrix A. The value of lda must be greater than or equal to the value of max(1, n). |
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 3;
float alpha = 2.9;
int incx = 1;
/**
* | (1.0, 0.0) (13.0, 5.0) (12.0, 0) |
* A = | (13.0, -5.0) (2.0, 0.0) (4.0, -18.0) |
* | (12.0, 0) (4.0, 18.0) (3.0, 0.0) |
*/
float ap[18] = {1.0, 0, 13.0, -5.0, 12.0, 0, 13.0, 5.0, 2.0, 0, 4.0, 18.0, 12.0, 0, 4.0, -18.0, 3.0, 0};
float x[6] = {2.0, -2.0, 14.0, 1, 3.0, 4.0};
cblas_cher(CblasColMajor, CblasLower, n, alpha, x, incx, ap, 3);
/**
* | 24.200001 0.000000 13.000000 5.000000 12.000000 0.000000 |
* Output A = | 88.400002 82.000000 573.300049 0.000000 4.000000 -18.000000|
* | 6.200001 40.600002 137.400009 171.700012 75.500000 0.000000 |
*/
Fortran interface:
INTEGER :: N=3
REAL(4) :: ALPHA=2.9
INTEGER :: INCX=1
COMPLEX(4) :: AP(3, 3)
DATA AP/(1.0, 0), (13.0, -5.0), (12.0, 0), (13.0, 5.0), (2.0, 0), (4.0, 18.0), (12.0, 0), (4.0, -18.0), (3.0, 0)/
COMPLEX(4) :: X(3)
DATA X/(2.0, -2.0), (14.0, 1), (3.0, 4.0)/
EXTERNAL CHER
CALL CHER('L', N, ALPHA, X, INCX, AP, LDA)
* | (24.200001, 0.000000) (13.000000 5.000000) (12.000000 0.000000) |
* Output A = | (88.400002, 82.000000) (573.300049 0.000000) (4.000000 -18.000000)|
* | (6.200001, 40.600002) (137.400009 171.700012) (75.500000 0.000000) |