?hpr2
Perform a rank-2 update of a Hermitian expansion matrix, that is,
.
Where alpha is a multiplication coefficient, x and y are vectors including n elements, and A is an n*n Hermitian matrix.
Interface Definition
C interface:
void cblas_chpr2(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 *Ap);
void cblas_zhpr2(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 *Ap);
Fortran interface:
CALL CHPR2(UPLO, N, ALPHA, X, INCX, Y, INCY, AP)
CALL ZHPR2(UPLO, N, ALPHA, X, INCX, Y, INCY, AP)
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 |
Hermitian matrix expansion storage mode (upper triangle expansion or lower triangle expansion)
|
Input |
N |
Integer |
Number of elements in vector X |
Input |
alpha |
|
Multiplication coefficient |
Input |
X |
|
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 |
|
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 |
Ap |
|
Matrix A triangle storage. The matrix scale is at least (n*(n+1)/2). |
Input/Output |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 3;
float alpha[2] = {1.0, 2.9};
int incx = 1, incy = 1;
/**
* | (2.0, 0.0) (13.0, 5.0) (12.0, -13.0) |
* A = | (13.0, -5.0) (2.0, 0.0) (4.0, -18.0) |
* | (12.0, 13.0) (4.0, 18.0) (1.0, 0.0) |
*/
float ap[12] = {2.0, 0, 13.0, -5.0, 12.0, 13.0, 2.0, 0, 4.0, 18.0, 1.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_chpr2(CblasColMajor, CblasLower, n, alpha, x, incx, y, incy, ap);
/**
* Output ap = |(18.0, 0.0), (65.0, 55.0), (8.0, 41.0), (396.0, 0.0), (96.0, 124.0), (51.0, 0.0)|
*/
Fortran interface:
INTEGER :: N=3
COMPLEX(4) :: ALPHA=(1.0, 2.9)
INTEGER :: INCX=1, INCY=1
COMPLEX(4) :: AP(6), X(3), Y(3)
DATA AP/(2.0, 0), (13.0, -5.0), (12.0, 13.0), (2.0, 0),
$ (4.0, 18.0), (1.0, 0)/
DATA X/(2.0, -2.0), (14.0, 1), (3.0, 4.0)/
DATA Y/(2.0, -2.0), (14.0, 1), (3.0, 4.0)/
EXTERNAL CHPR2
CALL CHPR2('L', N, ALPHA, X, INCX, Y, INCY, AP)
* Output AP = |(18.0, 0.0), (65.0, 55.0), (8.0, 41.0), (396.0, 0.0), (96.0, 124.0), (51.0, 0.0)|