?her2k
Perform a rank-2 update of a Hermitian matrix.
or
.
alpha and beta are multiplication coefficients, and C is an n*n Hermitian matrix. For a first case, the matrix A and the matrix B are n*k, and in a second case, the matrix A and the matrix B are k*n.
Interface Definition
C interface:
void cblas_cher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const void *alpha, const void *A, const BLASINT lda, const void *B, const BLASINT ldb, const float beta, void *C, const BLASINT ldc);
void cblas_zher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const void *alpha, const void *A, const BLASINT lda, const void *B, const BLASINT ldb, const double beta, void *C, const BLASINT ldc);
Fortran interface:
CALL CHER2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CALL ZHER2K(UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
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 matrix C |
Input |
Trans |
Enumeration type CBLAS_TRANSPOSE |
The matrices A and B are conventional matrices, transpose matrices, or conjugate matrices. |
Input |
N |
Integer |
Row of matrix C |
Input |
K |
Integer |
The columns of matrix A and matrix B when Trans = CblasNoTrans. The rows of matrix A and matrix B when Trans = CblasConjTrans. |
Input |
alpha |
|
Multiplication coefficient |
Input |
A |
|
Matrix A (lda, ka). If Trans = CblasNoTrans, ka = k; otherwise, ka = n. |
Input |
lda |
Integer |
|
Input |
B |
|
Matrix B (ldb, kb). If Trans = CblasNoTrans, kb = k; otherwise, kb = n. |
Input |
ldb |
Integer |
|
Input |
beta |
|
Multiplication coefficient |
Input |
C |
|
Matrix C (ldc, n) |
Input/Output |
ldc |
Integer |
The value of ldc is at least max(1, n). |
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 2, lda = 2, k = 2, ldb =3, ldc = 3;
float alpha[2] = {2.0, 1.0}, beta = 2.0;
/**
* | 4.0 1.0 1.0 2.0 |
* A(2 * 2) = | 3.0 2.0 4.0 1.0 |
*
* B(2 * 2) = | 2.0 1.0 3.0 2.0 |
* | 11.0 2.0 -2.0 1.0 |
*
* | 3.0 1.0 2.0 1.0 |
* C(3 * 2) = | -1.0 1.0 -6.0 2.0 |
* | . . |
*/
float a[8] = {4.0, 1.0, 3.0, 2.0, 1.0, 2.0, 4.0, 1.0};
float b[8] = {2.0, 1.0, 11.0, 2.0, 3.0, 2.0, -2.0, 1.0};
float c[12] = {3.0, 1.0, -1.0, 1.0, 0, 0, 2.0, 1.0, -6.0, 2.0, 0, 0};
cblas_cher2k(CblasColMajor, CblasUpper, CblasConjTrans, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
/**
* Output C
* | (218.0, 0.0) (123.0, -27.0) |
* C(3 * 2) = | (-1.0 1.0) (46.0, 0.0) |
* | . . |
*
*/
Fortran interface:
INTEGER :: N=2, K=2
INTEGER :: LDA=2, LDB=3, LDC=3
COMPLEX(4) :: ALPHA=(2.0, 1.0)
REAL(4) :: BETA=2.0
COMPLEX(4) :: A(2, 2), B(2, 2), C(3, 2)
DATA A/(4.0, 1.0), (3.0, 2.0), (1.0, 2.0), (4.0, 1.0)/
DATA B/(2.0, 1.0), (11.0, 2.0), (3.0, 2.0), (-2.0, 1.0)/
DATA C/(3.0, 1.0), (-1.0, 1.0), (0, 0), (2.0, 1.0), (-6.0, 2.0),
$ (0, 0)/
EXTERNAL CHER2K
CALL CHER2K('U', 'C', N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
* Output C
* | (218.0, 0.0) (123.0, -27.0) |
* C(3 * 2) = | (-1.0 1.0) (46.0, 0.0) |
* | . . |

