?scal
Compute the product of a vector and a coefficient, 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 vector X |
Input |
alpha |
|
Coefficient |
Input |
X |
|
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 |
Dependencies
#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