Rate This Document
Findability
Accuracy
Completeness
Readability

?sdot

Compute the dot product of the vectors with extended precision. The input is single-precision, and the calculation is based on double precision. The sdsdot output is single-precision type, and the dsdot output is double-precision type.

Interface Definition

C interface:

float cblas_sdsdot(const BLASINT n, const float alpha, const float *x, const BLASINT incx, const float *y, const BLASINT incy);

double cblas_dsdot(const BLASINT n, const float *x, const BLASINT incx, const float *y, const BLASINT incy);

Fortran interface:

RES = SDSDOT(N, ALPHA, SX, INCX, SY, INCY)

RES = DSDOT(N, SX, INCX, SY, INCY)

Parameters

Parameter

Type

Description

Input/Output

n

Integer

Number of elements in the x and y vectors

Input

alpha

For sdsdot, alpha is a single-precision type.

Single-precision scalar, which is added to the dot product and returned.

Input

x

x is of single-precision complex number type.

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

Input

incx

Integer

Increment of vector elements in x

Input

y

y is of single-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

Return Value

Result of vector dot product

  • For sdsdot, the return value is of the single-precision type.
  • For dsdot, the return value is of double-precision complex number type.

Dependencies

#include "kblas.h"

Examples

C interface:

    int n = 10, 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}; 
 
    double res = cblas_dsdot(n, x, incx, y, incy); 
    /** 
     *    Output:  0.126042 
     */

Fortran interface:

      REAL(8) :: RES 
      INTEGER :: N=10 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      REAL(4) :: X(10) 
      DATA X /0.340188, -0.105617, 0.283099, 0.298440, 0.411647, 
     $        -0.302449, -0.164777, 0.268230, -0.222225, 0.053970/ 
      REAL(4) :: Y(10) 
      DATA Y /-0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 
     $        0.416195, 0.135712, 0.217297, -0.358397, 0.106969/ 
      EXTERNAL DSDOT 
      RES=DSDOT(N,X,INCX,Y,INCY) 
 
*     Output :  0.126042