Rate This Document
Findability
Accuracy
Completeness
Readability

?her2

That is, . A is an n*n Hermitian matrix, alpha is a multiplication coefficient, and x and y are vectors including n elements each.

Interface Definition

C interface:

void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const void *alpha, const void *X, const BLASINT incX, const void *Y, const BLASINT incY, void *A, const BLASINT lda);

void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const void *alpha, const void *X, const BLASINT incX, const void *Y, const BLASINT incY, void *A, const BLASINT lda);

Fortran interface:

CALL CHER2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)

CALL ZHER2(UPLO, N, ALPHA, X, INCX, Y, INCY, 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

Indicates the storage mode of the Hermitian matrix (upper triangle or lower triangle).

  • If Uplo = CblasUpper, the upper triangle of A is used.
  • If Uplo = CblasLower, the lower triangle of A is used.

Input

N

Integer

Number of elements in vector X.

Input

alpha

  • Single-precision complex type for cher2
  • Double-precision complex type for zher2

Multiplication coefficient.

Input

X

  • Single-precision complex type for cher2
  • Double-precision complex type for zher2

Matrix X. The length must be at least 1+(n-1)*abs(incX).

Input

incX

Integer

Increment for elements in vector X. The value cannot be 0.

Input

Y

  • Single-precision complex type for cher2
  • Double-precision complex type for zher2

Matrix Y. The length must be at least 1+(n-1)*abs(incY).

Input

incY

Integer

Increment for elements in vector Y. The value cannot be 0.

Input

A

  • Single-precision complex type for cher2
  • Double-precision complex type for zher2

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 max(1, n).

Input

Dependency

#include "kblas.h"

Examples

C interface:

    int n = 3; 
    float alpha[2] = {1.0, 2.9}; 
    int incx = 1, incy = 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}; 
    float y[6] = {2.0, -2.0, 14.0, 1, 3.0, 4.0}; 
 
    cblas_cher2(CblasColMajor, CblasLower, n, alpha, x, incx, y, incy, ap, 3); 
    /** 
     *             | 17.000000 0.000000      13.000000 5.000000      12.000000 0.000000 | 
     *  Output A = | 65.000000 55.000000     396.000000 0.000000     4.000000 -18.000000| 
     *             | 8.000000 28.000000      96.000000 124.000000    53.000000 0.000000 | 
     */

Fortran interface:

      INTEGER :: N=3 
      COMPLEX(4) :: ALPHA=(1.0, 2.9) 
      INTEGER :: INCX=1 
      INTEGER :: INCY=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)/ 
      COMPLEX(4) :: Y(3) 
      DATA Y/(2.0, -2.0), (14.0, 1), (3.0, 4.0)/ 
      EXTERNAL CHER2 
      CALL CHER2('L', N, ALPHA, X, INCX, Y, INCY, A, LDA) 
 
*                | 17.000000 0.000000      13.000000 5.000000      12.000000 0.000000 | 
*     Output A = | 65.000000 55.000000     396.000000 0.000000     4.000000 -18.000000| 
*                | 8.000000 28.000000      96.000000 124.000000    53.000000 0.000000 |