SSCAL(3dxml) — Subroutines
Name
sscal, dscal, cscal, zscal, csscal, zdscal − Product of a scalar and a vector
FORMAT
{S,D,C,Z}SCAL (n, alpha, x, incx) CSSCAL (n, alpha, x, incx) ZDSCAL (n, alpha, x, incx)
Arguments
ninteger∗4
On entry, the number of elements in the vector x.
On exit, n is unchanged.
alphareal∗4 | real∗8 | complex∗8 | complex∗16
On entry, the scalar value used to multiply the elements of vector x.
On exit, alpha is unchanged.
xreal∗4 | real∗8 | complex∗8 | complex∗16
On entry, a one-dimensional array X of length at least (1+(n-1)∗|incx|), containing the elements of the vector x.
On exit, if n<=0 or alpha = 1.0, then x is unchanged. Otherwise, x is overwritten; x(i) is replaced by alpha∗x(i).
incxinteger∗4
On entry, the increment for the array X.
If incx > 0, vector x is stored forward in the array, so that x(i) is stored in location X(1+(i-1)∗incx).
If incx < 0, vector x is stored backward in the array, so that x(i) is stored in location X(1+(n-i)∗|incx|).
If incx = 0, only the first element in the array is scaled.
On exit, incx is unchanged.
Description
These routines perform the following operation: x = alpha∗x
SSCAL and DSCAL scale the elements of a real vector by computing the product of the vector and a real scalar alpha∗x. CSCAL and ZSCAL scale the elements of a complex vector by computing the product of the vector and a complex scalar alpha. CSSCAL and ZDCAL scale the elements of a complex vector by computing the product of the vector and a real scalar alpha.
If n<=0 or alpha = 1.0, x is unchanged.
If incx < 0, the result is identical to using |incx|.
If alpha = 0.0 or (0.0, 0.0), the computation is a time-consuming way of setting all elements of the vector x equal to zero. Use the BLAS Level 1 Extensions subroutines _SET to set all the elements of a vector to a scalar.
The _SCAL routines are similar to the BLAS Level 1 Extensions subroutines _VCAL routines, but the _VCAL routines use an output vector different from the input vector.
Example
INTEGER∗4 INCX, N
COMPLEX∗8 X(20), alpha
INCX = 1
alpha = (2.0, 1.0)
N = 20
CALL CSCAL(N,alpha,X,INCX)
This FORTRAN code shows how to scale a complex vector x by the complex scalar (2.0, 1.0).