Rate This Document
Findability
Accuracy
Completeness
Readability

?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

  • For cdotc, x is of single-precision complex number type.
  • For zdotc, 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 for the elements of vector x

Input

y

  • For cdotc, y is of single-precision complex number type.
  • For zdotc, 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 the elements of 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_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 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 CDOTC 
      RES=CDOTC(N,CX,INCX,CY,INCY) 
 
*     Output : (0.126043, 0.317066)