VCOS_SIN (x, incx, y, incy, z, incz, n)
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 cos(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. z real*8 On entry, a one-dimensional array Z of length at least (1+(n-1)*incz). On exit, if n <= 0, z is unchanged. If n > 0, z is overwritten; z(i) is replaced by sin(x(i)). incz integer*4 On entry, the increment for the array Z. As incz > 0, vector z is stored forward in the array, so that z(i) is stored in location Z(1+(i-1)*incz). On exit, incz is unchanged. n integer*4 On entry, the number of elements to process. On exit, n is unchanged.
The VCOS_SIN function computes the cosine and sine of n elements of a vector as follows: y(i) = cos(x(i)) z(i) = sin(x(i)) where x, y and z are vectors. If both the sine and the cosine of a vector are required, then this routine is faster than calling VCOS and VSIN separately.
INTEGER*4 N, INCX, INCY REAL*8 X(20), Y(20), z(20) INCX = 1 INCY = 1 INCZ = 1 N = 20 CALL VCOS_SIN(X,INCX,Y,INCY,Z,INCZ,N) This FORTRAN code shows how the cosine and sine of all elements of the real vector x are obtained and set equal to the corresponding elements of the vectors y and z, respectively.