Rate This Document
Findability
Accuracy
Completeness
Readability

?herk

Perform a rank-k update of a Hermitian matrix.

or .

alpha and beta are the real multiplication coefficients, and C is an n*n Hermitian matrix. In a first case, the matrix A is n*k, and in a 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

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 matrix A is a conventional matrix or a conjugate matrix.

  • If Trans = CblasNoTrans,

  • If Trans = CblasConjTrans,

Input

N

Integer

Order of matrix C

Input

K

Integer

  • Number of columns of matrix A when Trans = CblasNoTrans.
  • Number of rows of matrix A when Trans = CblasConjTrans.

Input

alpha

  • For cherk, alpha is a single-precision real number type.
  • For zherk, alpha is of double-precision real number type.

Multiplication coefficient

Input

A

  • For cherk, A is of single-precision complex number type.
  • For zherk, A is of double-precision complex number type.

Matrix A (lda, ka).

If Trans = CblasNoTrans, ka = k; otherwise, ka = n.

Input

lda

Integer

  • If the matrix is column store and Trans = CblasNoTrans, lda must be at least max(1, n). Otherwise, lda must be at least max(1, k).
  • If the matrix is row store and Trans = CblasNoTrans, lda must be at least max(1, k). Otherwise, lda must be at least max(1, n).

Input

beta

  • For cherk, beta isof single-precision real number type.
  • For zherk, beta is of the double precision type.

Multiplication coefficient

Input

C

  • For cherk, C is of single-precision complex number type.
  • For zherk, C is of the double-precision complex number type.

Matrix C (ldc, n)

Input/Output

ldc

Integer

ldc must be at least max(1, n).

Input

Dependencies

#include "kblas.h"

Examples

C interface:

    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) | 
*