?herk
Perform a rank-k update of the product of a complex matrix and a matrix. Matrix C is a complex Hermitian matrix.
That is,
or
.
alpha and beta are the real multiplication coefficients, and C is an n*n Hermitian matrix. In the first case, the matrix A is n*k, and in the second case, the matrix A is k*n.
Interface Definition
C interface:
void cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const float alpha, const void *A, const BLASINT lda, const float beta, void *C, const BLASINT ldc);
void cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const BLASINT N, const BLASINT K, const double alpha, const void *A, const BLASINT lda, const double beta, void *C, const BLASINT ldc);
Fortran interface:
CALL CHERK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CALL ZHERK(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
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 storage mode of matrix C. |
Input |
|
Trans |
Enumeration type CBLAS_TRANSPOSE |
Whether matrix A is non-transposed or conjugated. |
Input |
|
N |
Integer |
Order of matrix C. |
Input |
|
K |
Integer |
|
Input |
|
alpha |
|
Multiplication coefficient. |
Input |
|
A |
|
Matrix A (lda, ka). If Trans = CblasNoTrans, ka = k; otherwise, ka = n. |
Input |
|
lda |
Integer |
|
Input |
|
beta |
|
Multiplication coefficient. |
Input |
|
C |
|
Matrix C (ldc, n). |
Input/Output |
|
ldc |
Integer |
ldc must be at least max(1, n). |
Input |
Dependency
#include "kblas.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
int n = 2, lda = 2, k = 2, ldc = 2; float alpha = 2.0, beta = 2.0; /** * | 4.0 1.0 1.0 2.0 | * A(2 * 2) = | 3.0 2.0 4.0 1.0 | * * | 3.0 1.0 2.0 1.0 | * C(2 * 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 c[8] = {3.0, 1.0, -1.0, 1.0, 2.0, 1.0, -6.0, 2.0}; cblas_cherk(CblasColMajor, CblasUpper, CblasConjTrans, n, k, alpha, a, lda, beta, c, ldc); /** * Output C * | (66.0, 0.0) (44.0, 6.0) | * C(2 * 2) = | (-1.0, 1.0) (32.0, 0.0) | * */ |
Fortran interface:
INTEGER :: N=2, K=2
INTEGER :: LDA=2, LDC=2
REAL(4) :: ALPHA=2.0
REAL(4) :: BETA=2.0
COMPLEX(4) :: A(2, 2), C(2, 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), (2.0, 1.0), (-6.0, 2.0)/
EXTERNAL CHERK
CALL CHERK('U', 'C', N, K, ALPHA, A, LDA, BETA, C, LDC)
* Output C
* | (66.0, 0.0) (44.0, 6.0) |
* C(2 * 2) = | (-1.0, 1.0) (32.0, 0.0) |
*

