CXML
vrecip
FORMAT
VRECIP (x, incx, y, incy, n)
Arguments
x real*8
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.
incx integer*4
On entry, the increment for the array X. As incx > 0,
vector x is stored forward in the array, so that x(i)
is stored in location X(1+(i-1)*incx).
On exit, incx is unchanged.
y real*8
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; y(i) is replaced by 1/(x(i)).
incy integer*4
On entry, the increment for the array Y. As incy > 0,
vector y is stored forward in the array, so that y(i)
is stored in location Y(1+(i-1)*incy).
On exit, incy is unchanged.
n integer*4
On entry, the number of elements to process.
On exit, n is unchanged.
Description
The VRECIP function computes the reciprocal of n elements of a vector as
follows:
y(i) = 1/(x(i))
where x and y are vectors.
Example
INTEGER*4 N, INCX, INCY
REAL*8 X(20), Y(20)
INCX = 1
INCY = 1
N = 20
CALL VRECIP(X,INCX,Y,INCY, N)
This FORTRAN code shows how the reciprocal of all elements of the real
vector x is obtained and set equal to the corresponding elements of the
vector y.
CXML Home Page Index of CXML Routines