SSET(3dxml) — Subroutines
Name
sset, dset, cset, zset − Set all elements of a vector to a scalar
FORMAT
{S,D,C,Z}SET (n, alpha, x, incx)
Arguments
ninteger∗4
On entry, the number of elements in the vector.
On exit, n is unchanged.
alphareal∗4 | real∗8 | complex∗8 | complex∗16
On entry, the scalar alpha value.
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, x is unchanged. If n > 0, x is overwritten by the updated x.
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.
Description
The _SET subroutines change all elements of a vector to the same scalar value; each element x(i) is replaced with alpha. x(i) = alpha
If incx < 0, the result is identical to using |incx|. If incx = 0, the computation is a time-consuming way of setting x(1) = alpha.
Example
INTEGER∗4 N, INCX
REAL∗4 X(200), alpha
INCX = 2
alpha = 2.0
N = 50
CALL SSET(N,alpha,X,INCX)
This FORTRAN example shows how to set all elements of the vector x equal to 2.0.