我要评分
获取效率
正确性
完整性
易理解

?her

Perform a rank-1 update of a Hermitian matrix, .

A is an n*n Hermitian matrix, alpha is a multiplication coefficient, and x is a vector with n elements.

Interface Definition

C interface:

void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const void *X, const BLASINT incX, void *A, const BLASINT lda);

void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const void *X, const BLASINT incX, void *A, const BLASINT lda);

Fortran interface:

CALL CHER(UPLO, N, ALPHA, X, INCX, A, LDA)

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

Storage mode of a Hermitian matrix (upper triangle or lower triangle)

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

Input

N

Integer

Number of elements in vector X

Input

alpha

  • For cher, alpha is of single-precision floating-point type.
  • For zher, alpha is of double-precision floating-point type.

Multiplication coefficient

Input

X

  • For cher, X is of single-precision complex number type.
  • For zher, X is of double-precision complex number type.

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

A

  • For cher, A is of single-precision complex number type.
  • For zher, A is of double-precision complex number type.

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

Dependencies

#include "kblas.h"

Examples

C interface:
    int n = 3; 
    float alpha = 2.9; 
    int incx = 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}; 
 
    cblas_cher(CblasColMajor, CblasLower, n, alpha, x, incx, ap, 3); 
    /** 
     *             | (24.200001, 0.000000)  (13.000000   5.000000)     (12.000000  0.000000)  | 
     * Output  A = | (88.400002, 82.000000) (573.300049  0.000000)     (4.000000   -18.000000)| 
     *             | (6.200001, 40.600002)  (137.400009  171.700012)   (75.500000   0.000000) |

     */

Fortran interface:

      INTEGER :: N=3 
      REAL(4) :: ALPHA=2.9 
      INTEGER :: INCX=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)/ 
      EXTERNAL CHER 
      CALL CHER('L', N, ALPHA, X, INCX, AP, LDA) 
 
*                 | (24.200001, 0.000000)  (13.000000   5.000000)     (12.000000  0.000000)  | 
*     Output  A = | (88.400002, 82.000000) (573.300049  0.000000)     (4.000000   -18.000000)| 
*                 | (6.200001, 40.600002)  (137.400009  171.700012)   (75.500000   0.000000) |