Rate This Document
Findability
Accuracy
Completeness
Readability

?her2k

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

Indicates the storage mode of matrix C.

Input

Trans

Enumeration type CBLAS_TRANSPOSE

Indicates whether matrices A and B are conventional matrices, transpose matrices, or conjugate matrices.

  • If Trans = CblasNoTrans,

    .

  • If Trans = CblasConjTrans,

    .

Input

N

Integer

Number of rows of matrix C.

Input

K

Integer

Indicates the columns of matrix A and matrix B when Trans = CblasNoTrans.

Indicates the rows of matrix A and matrix B when Trans = CblasConjTrans.

Input

alpha

  • Single-precision complex type for cher2k
  • Double-precision complex type for zher2k

Multiplication coefficient.

Input

A

  • Single-precision complex type for cher2k
  • Double-precision complex type for zher2k

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 column store and Trans = CblasNoTrans, lda must be at least max(1, k); otherwise, lda must be at least max(1, n).

Input

B

  • Single-precision complex type for cher2k
  • Double-precision complex type for zher2k

Matrix B (ldb, kb).

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

Input

ldb

Integer

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

Input

beta

  • Single-precision complex type for cher2k
  • Double-precision complex type for zher2k

Multiplication coefficient.

Input

C

  • Single-precision complex type for cher2k
  • Double-precision complex type for zher2k

Matrix C (ldc, n).

Input/Output

ldc

Integer

The value of ldc is at least max(1, n).

Input

Dependency

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