Rate This Document
Findability
Accuracy
Completeness
Readability

?scal

Scale a vector.

That is, . alpha is a multiplication coefficient, and x is a vector including n elements.

Interface Definition

C interface:

void cblas_dscal(const BLASINT N, const double alpha, double *X, const BLASINT incX);

void cblas_sscal(const BLASINT N, const float alpha, float *X, const BLASINT incX);

void cblas_cscal(const BLASINT N, const void *alpha, void *X, const BLASINT incX);

void cblas_zscal(const BLASINT N, const void *alpha, void *X, const BLASINT incX);

void cblas_csscal(const BLASINT N, const double alpha, void *X, const BLASINT incX);

void cblas_zdscal(const BLASINT N, const double alpha, void *X, const BLASINT incX);

Fortran interface:

CALL SSCAL(N, ALPAH, X, INCX)

CALL DSCAL(N, ALPAH, X, INCX)

CALL CSCAL(N, ALPAH, X, INCX)

CALL ZSCAL(N, ALPAH, X, INCX)

CALL CSSCAL(N, ALPAH, X, INCX)

CALL ZDSCAL(N, ALPAH, X, INCX)

Parameters

Parameter

Type

Description

Input/Output

N

Integer

Number of elements in the X vector.

Input

alpha

  • Double-precision floating-point type for dscal
  • Single-precision floating-point type for sscal
  • Single-precision complex type for cscal
  • Double-precision complex type for zscal
  • Single-precision floating-point type for csscal
  • Double-precision floating-point type for zdscal

Coefficient.

Input

X

  • Double-precision floating-point type for dscal
  • Single-precision floating-point type for sscal
  • Single-precision complex type for cscal
  • Double-precision complex type for zscal
  • Single-precision complex type for csscal
  • Double-precision complex type for zdscal

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

Input/Output

incX

Integer

Increment for the elements of vector X.

Input

Dependency

#include "kblas.h"

Examples

C interface:

    float alpha = 2.0; 
    int n = 5, incx = 1; 
    /** 
     * X: 0.340188, -0.105617, 0.283099, 0.298440, 0.411647 
     */ 
    float x[5] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647}; 
 
    cblas_sscal(n, alpha, x, incx); 
    /** 
     * Output X: 0.680375, -0.211234, 0.566198, 0.596880, 0.823295 
     */

Fortran interface:

      REAL(4) :: ALPHA=2.0 
      INTEGER :: N=5 
      INTEGER :: INCX=1 
      REAL(4) :: X(5) 
      DATA X /0.340188, -0.105617, 0.283099, 0.298440, 0.411647/ 
      EXTERNAL SSCAL 
      CALL SSCAL(N, ALPHA, X, INCX) 
 
*     Output X: 0.680375, -0.211234, 0.566198, 0.596880, 0.823295