NAME dcosti - initialize the array xWSAVE, which is used in xCOST. SYNOPSIS SUBROUTINE COSTI (N, RWSAVE) SUBROUTINE DCOSTI (N, DWSAVE) SUBROUTINE VCOSTI (N, RWSAVE) SUBROUTINE VDCOSTI (N, DWSAVE) #include <sunperf.h> void costi (int n, float *rwsave) ; void dcosti (int n, double *dwsave) ; void vcosti (int n, float *rwsave) ; void vdcosti (int n, float *dwsave) ; ARGUMENTS N Length of the sequence to be transformed. The method is most efficient when N - 1 is a product of small primes. N >= 2. xWSAVE On entry, an array with a dimension of at least (3 * N + 15). Different xWSAVE arrays are required for different values of N. This initialization does not have to be repeated between calls to xCOST as long as N and xWSAVE remain unchanged, thus subsequent transforms can be obtained faster than the first. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER N PARAMETER (N = 9) C INTEGER I REAL PI, X(N), WSAVE(3 * N + 15) C EXTERNAL COST, COSTI INTRINSIC ACOS, COS C C Initialize the array X to an even sequence, that is, it can be C expanded in terms of a trigonometric series that contains only C cosine terms. C PI = ACOS (-1.0) DO 100, I=1, N X(I) = COS ((I - 1.0) * 2.0 * PI / (N - 1.0)) 100 CONTINUE C CALL COSTI (N, WSAVE) PRINT 1000 PRINT 1010, (X(I), I = 1, N) CALL COST (N, X, WSAVE) PRINT 1020 PRINT 1010, (X(I), I = 1, N) CALL COST (N, X, WSAVE) PRINT 1030 PRINT 1010, (X(I), I = 1, N) C 1000 FORMAT (1X, 'Original Sequence: ') 1010 FORMAT (1X, 100(F5.1, 1X)) 1020 FORMAT (1X, 'Transformed Sequence: ') 1030 FORMAT (1X, 'Recovered Sequence: ') END SAMPLE OUTPUT Original Sequence: 1.0 0.7 0.0 -0.7 -1.0 -0.7 0.0 0.7 1.0 Transformed Sequence: 0.0 0.0 8.0 0.0 0.0 0.0 0.0 0.0 0.0 Recovered Sequence: 16.0 11.3 0.0 -11.3 -16.0 -11.3 0.0 11.3 16.0
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |