?hpr
Perform a rank-1 update of a triangular expanded Hermitian matrix, that is,
.
Where alpha is a scaling coefficient, x is a vector including n elements, and A is a triangularly expanded Hermitian matrix.
Interface Definition
C interface:
void cblas_chpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const void *X, const BLASINT incX, void *A);
void cblas_zhpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const void *X,const BLASINT incX, void *A);
Fortran interface:
CALL CHPR(UPLO, N, ALPHA, X, INCX, AP)
CALL ZHPR(UPLO, N, ALPHA, X, INCX, 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 |
Expansion storage mode of a Hermitian matrix (upper triangle or lower triangle)
|
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 |
A |
|
Matrix A: The matrix scale is at least (n*(n+1)/2). |
Input/Output |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 3;
float alpha = 1.0;
int incx = 1;
/**
* | (2.0, 0.0) (13.0, 5.0) (12.0, -13.0) |
* A = | (13.0, -5.0) (3.0, 0.0) (4.0, -18.0) |
* | (12.0, 13.0) (4.0, 18.0) (2.0, 0.0) |
*/
float ap[12] = {2.0, 0, 13.0, -5.0, 12.0, 13.0, 3.0, 0, 4.0, 18.0, 2.0, 0};
float x[6] = {2.0, -2.0, 14.0, 1, 3.0, 4.0};
cblas_chpr(CblasColMajor, CblasLower, n, alpha, x, incx, ap);
/**
* Output ap = |(10.0, 0.0), (39.0, 25.0), (10.0, 27.0), (200.0, 0.0), (50.0, 71.0), (27.0, 0.0) |
*/
Fortran interface:
INTEGER :: N=3
REAL(4) :: ALPHA=1.0
INTEGER :: INCX=1
COMPLEX(4) :: AP(6), X(3)
DATA AP/(2.0, 0), (13.0, -5.0), (12.0, 13.0), (3.0, 0),
$ (4.0, 18.0), (2.0, 0)/
DATA X/(2.0, -2.0), (14.0, 1), (3.0, 4.0)/
EXTERNAL CHPR
CALL CHPR('L', N, ALPHA, X, INCX, AP)
* Output AP = | (10.0, 0.0), (39.0, 25.0), (10.0, 27.0), (200.0, 0.0), (50.0, 71.0), (27.0, 0.0) |