SVCAL(3dxml) — Subroutines
Name
svcal, dvcal, cvcal, zvcal, csvcal, zdvcal − Product of a scalar and a vector
FORMAT
{S,D,C,Z}VCAL (n, alpha, x, incx, y, incy) CSVCAL (n, alpha, x, incx, y, incy) ZDVCAL (n, alpha, x, incx, y, incy)
Arguments
ninteger∗4
On entry, the number of elements of the vector x.
On exit, n is unchanged.
alphareal∗4 | real∗8 | complex∗8 | complex∗16
On entry, the scalar multiplier alpha.
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, x is unchanged.
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 is accessed.
On exit, incx is unchanged.
yreal∗4 | real∗8 | complex∗8 | complex∗16
On entry, a one-dimensional array Y of length at least (1+(n-1)∗|incy|).
On exit, if n<=0, y is unchanged. If n > 0, y is overwritten; each element y(i) is replaced by alpha∗x(i).
incyinteger∗4
On entry, the increment for the array Y.
If incy >= 0, vector y is stored forward in the array, so that y(i) is stored in location Y(1+(i-1)∗incy)
If incy < 0, vector y is stored backward in the array, so that y(i) is stored in location Y(1+(n-i)∗|incy|).
On exit, incy is unchanged.
Description
SVCAL and DVCAL compute the product of a real scalar and a real vector, in single or double precision. CVCAL and ZVCAL compute the product of a complex scalar and a complex vector, in single or double precision. CSVCAL and ZDVCAL compute the product of a real scalar and a complex vector in single or double precision.
These subprograms multiply each element of a vector by a scalar value, returning the result in vector y: y = alpha∗x
If incy = 0, the result is unpredictable. If incx = 0, each element in y is equal to ALPHA∗X(1).
If alpha = 0, the computation is a time-consuming way of setting all elements of the vector y equal to zero. Use the _SET routines to perform that operation.
EXAMPLES
INTEGER∗4 N, INCX, INCY
REAL∗4 X(20), Y(40), alpha
INCX = 1
INCY = 2
alpha = 2.0
N = 20
CALL SVCAL(N,alpha,X,INCX,Y,INCY)
This FORTRAN example shows how to scale a vector x by 2.0. Vector y is set equal to the result.
INTEGER∗4 N, INCX, INCY
COMPLEX∗8 X(20), Y(40), alpha
INCX = 1
INCY = 2
alpha = (5.0, 1.0)
N = 20
CALL CVCAL(N,alpha,X,INCX,Y,INCY)
This FORTRAN example shows how to scale a vector x by the complex number (5.0,1.0). Vector y is set equal to the result.