?geru
Perform a rank-1 update of a general conjugate matrix, that is,
.
alpha is a multiplication coefficient, A is a general m x n matrix, x is a vector including m elements, and y is a vector including n elements.
Interface Definition
C interface:
void cblas_cgeru(const enum CBLAS_ORDER order, const BLASINT M, 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_zgeru(const enum CBLAS_ORDER order, const BLASINT M, 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 CGERU(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CALL ZGERU(M, 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 |
M |
Integer |
Number of rows in matrix A |
Input |
N |
Integer |
Number of columns in matrix A |
Input |
alpha |
|
Multiplication coefficient |
Input |
X |
|
Matrix X. The vector scale is at least (1+(m-1)*abs(incx)). |
Input |
incX |
Integer |
Increment for elements in vector X. The value cannot be 0. |
Input |
Y |
|
Matrix Y. The vector size is at least (1+(n-1)*abs(incy)). |
Input |
incY |
Integer |
Increment for elements in vector Y. The value cannot be 0. |
Input |
A |
|
Matrix A(lda, n) |
Output |
lda |
Integer |
Length of the primary dimension in matrix A. If A is a column-store matrix, lda must be greater than or equal to max(1, m). Otherwise, lda must be greater than or equal to max(1,n). |
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int m = 4, n = 4, lda = 4;
float alpha[2] = {1.0, 2.0};
int incx = 1, incy = 1;
/**
* X:
* 0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230
* Y:
* -0.222225, 0.053970, -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195
* A:
* 0.135712, 0.217297, -0.343321, -0.099056, 0.112640, -0.203968, 0.026745, 0.269914
* -0.358397, 0.106969, -0.370210, -0.391191, 0.137552, 0.024287, -0.099771, 0.391529
* -0.483699, -0.257113, 0.498924, -0.281743, -0.006417, 0.472775, -0.216685, -0.147542
* -0.362768, 0.304177, 0.012932, 0.339112, -0.207483, 0.271358, 0.307725, 0.419026
*/
float x[8] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230};
float y[8] = {-0.222225, 0.053970, -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195};
float a[32] = {0.135712, 0.217297, -0.343321, -0.099056, 0.112640, -0.203968, 0.026745, 0.269914,
-0.358397, 0.106969, -0.370210, -0.391191, 0.137552, 0.024287, -0.099771, 0.391529,
-0.483699, -0.257113, 0.498924, -0.281743, -0.006417, 0.472775, -0.216685, -0.147542,
-0.362768, 0.304177, 0.012932, 0.339112, -0.207483, 0.271358, 0.307725, 0.419026};
cblas_cgeru(CblasColMajor, m, n, alpha, x, incx, y, incy, a, 4);
/**
* Output A:
* -0.017847 0.119331 -0.444931 0.165040 -0.565962 -0.327440 -0.352610 0.793599
* -0.320256 -0.308135 -0.474544 -0.451172 0.529765 -0.402861 -0.488827 0.599533
* -0.141372 -0.264850 0.047453 0.143518 -0.150850 0.415971 0.035456 0.929981
* 0.185887 0.245696 -0.076018 0.302546 -0.121045 -0.148647 0.016127 0.099442
*/
Fortran interface:
INTEGER :: M=4
INTEGER :: N=4
INTEGER :: LDA=4
INTEGER :: INCX=1
INTEGER :: INCY=1
COMPLEX(4) :: ALPHA=(1.0, 2.0)
COMPLEX(4) :: A(4, 4)
DATA A/(0.135712, 0.217297), (-0.343321, -0.099056),
$ (0.112640, -0.203968), (0.026745, 0.269914),
$ (-0.358397, 0.106969), (-0.370210, -0.391191),
$ (0.137552, 0.024287), (-0.099771, 0.391529),
$ (-0.483699, -0.257113), (0.498924, -0.281743),
$ (-0.006417, 0.472775), (-0.216685, -0.147542),
$ (-0.362768, 0.304177), (0.012932, 0.339112),
$ (-0.207483, 0.271358), (0.307725, 0.419026)/
COMPLEX(4) :: X(4)
DATA X/(0.340188, -0.105617), (0.283099, 0.298440),
$ (0.411647, -0.302449), (-0.164777, 0.268230)/
COMPLEX(4) :: Y(4)
DATA Y/(-0.222225, 0.053970), (-0.022603, 0.128871),
$ (-0.135216, 0.013401), (0.452230, 0.416195)/
EXTERNAL CGERU
CALL CGERU(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
* Output A:
* -0.017847 0.119331 -0.444931 0.165040 -0.565962 -0.327440 -0.352610 0.793599
* -0.320256 -0.308135 -0.474544 -0.451172 0.529765 -0.402861 -0.488827 0.599533
* -0.141372 -0.264850 0.047453 0.143518 -0.150850 0.415971 0.035456 0.929981
* 0.185887 0.245696 -0.076018 0.302546 -0.121045 -0.148647 0.016127 0.099442