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

?dotu

Compute the dot product of two complex number vectors.

Interface Definition

C interface:

float _Complex cblas_cdotu(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy);

void cblas_cdotu_sub(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy, void *ret);

double _Complex cblas_zdotu(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy);

void cblas_zdotu_sub(const BLASINT n, const void *x, const BLASINT incx, const void *y, const BLASINT incy, void *ret);

Fortran interface:

RES = CDOTU(N, CX, INCX, CY, INCY)

RES = ZDOTU(N, CX, INCX, CY, INCY)

Parameters

Parameter

Type

Description

Input/Output

n

Integer

Number of elements in the x and y vectors

Input

x

  • For cdotu, x is of single-precision complex number type.
  • For zdotu, x is of double-precision complex number type.

Vector x. The vector size is at least (1+(n-1)*abs(incX)).

Input

incx

Integer

Increment of elements in vector x

Input

y

  • For cdotu, y is of single-precision complex number type.
  • For zdotu, y is of double-precision complex number type.

Vector y. The vector size is at least (1+(n-1)*abs(incy)).

Input

incy

Integer

Increment for elements in vector y

Input

ret

  • For cdotc, ret is of single-precision complex number type.
  • For zdotc, ret is of double-precision complex number type.

Calculation result

Output

Dependencies

#include "kblas.h"

Examples

C interface:

    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_cdotu(n, x, incx, y, incy); 
    /** 
     *    Output:  0.268904 0.001699 
     * 
     */

Fortran interface:

      COMPLEX(4) :: RES 
      INTEGER :: N=5 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      COMPLEX(4) :: X(5) 
      DATA CX/(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 CY/(-0.022603, 0.128871), (-0.135216, 0.013401), 
     $        (0.452230, 0.416195), (0.135712, 0.217297), 
     $        (-0.358397, 0.106969)/ 
      EXTERNAL CDOTU 
      RES=CDOTU(N, CX, INCX, CY, INCY) 
 
*     Output : (0.268904 0.001699)