?dotc
Compute the dot product of a conjugate vector and another vector.
That is,
. x and y are complex number vectors with a length of n.
Interface Definition
C interface:
float _Complex cblas_cdotc(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy);
void cblas_cdotc_sub(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy, void *ret);
double _Complex cblas_zdotc(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy);
void cblas_zdotc_sub(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy, void *ret);
Fortran interface:
RES = CDOTC(N, CX, INCX, CY, INCY)
RES = ZDOTC(N, CX, INCX, CY, INCY)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
n |
Integer |
Number of elements in the x and y vectors. |
Input |
x |
|
Vector x. The vector size is at least (1+(n-1)*abs(incx)). |
Input |
incx |
Integer |
Increment for the elements of vector x. |
Input |
y |
|
Vector y. The vector size is at least (1+(n-1)*abs(incy)). |
Input |
incy |
Integer |
Increment for the elements of vector y. |
Input |
ret |
|
Calculation result. |
Output |
Dependency
#include "kblas.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | int n = 5, incx = 1, incy = 1; /** * X: * 0.340188, -0.105617, 0.283099, 0.298440, 0.411647, * -0.302449, -0.164777, 0.268230, -0.222225, 0.053970 * Y: * -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, * 0.416195, 0.135712, 0.217297, -0.358397, 0.106969 */ float x[10] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230, -0.222225, 0.053970}; float y[10] = {-0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195, 0.135712, 0.217297, -0.358397, 0.106969}; float _Complex res = cblas_cdotc(n, x, incx, y, incy); /** * Output: 0.126042, 0.317067 * */ |
Fortran interface:
COMPLEX(4) :: RES
INTEGER :: N=5
INTEGER :: INCX=1
INTEGER :: INCY=1
COMPLEX(4) :: X(5)
DATA X/(0.340188, -0.105617), (0.283099, 0.298440),
$ (0.411647, -0.302449), (-0.164777, 0.268230),
$ (-0.222225, 0.053970)/
COMPLEX(4) :: Y(5)
DATA Y/(-0.022603, 0.128871), (-0.135216, 0.013401),
$ (0.452230, 0.416195), (0.135712, 0.217297),
$ (-0.358397, 0.106969)/
EXTERNAL CDOTC
RES=CDOTC(N,X,INCX,Y,INCY)
* Output : (0.126043, 0.317066)