NAME cosqi - initialize the array xWSAVE, which is used in both xCOSQF and xCOSQB. SYNOPSIS SUBROUTINE COSQI (N, RWSAVE) SUBROUTINE DCOSQI (N, DWSAVE) SUBROUTINE VCOSQI (N, RWSAVE) SUBROUTINE VDCOSQI (N, DWSAVE) #include <sunperf.h> void cosqi (int n, float *rwsave) ; void dcosqi (int n, double *dwsave) ; void vcosqi (int n, float *rwsave) ; void vdcosqi (int n, float *dwsave) ; ARGUMENTS N Length of the sequence to be transformed. The method is most efficient when N is a product of small primes. xWSAVE On entry, an array with a dimension of at least (3 * N + 15) for scalar subroutines or (2 * N + 15) for vector subroutines. The same work array can be used for both xCOSQF and xCOSQB as long as N remains unchanged. Different xWSAVE arrays are required for different values of N. This initial- ization does not have to be repeated between calls to xCOSQF or xCOSQB 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 = 6) C INTEGER I REAL PI, WSAVE(3 * N + 15), X(N) C EXTERNAL COSQB, COSQF, COSQI INTRINSIC ACOS, COS C C Initialize array X to a real even quarter-wave sequence, that is, C it can be expanded in terms of a cosine series with only odd wave C numbers. C PI = ACOS (-1.0) DO 100, I=1, N X(I) = COS((I - 1) * PI / (2.0 * N)) 100 CONTINUE C CALL COSQI (N, WSAVE) PRINT 1000 PRINT 1010, (X(I), I = 1, N) CALL COSQF (N, X, WSAVE) PRINT 1020 PRINT 1010, (X(I), I = 1, N) CALL COSQB (N, X, WSAVE) PRINT 1030 PRINT 1010, (X(I), I = 1, N) C 1000 FORMAT(1X, 'Original Sequence: ') 1010 FORMAT(1X, 100(F7.3, 1X)) 1020 FORMAT(1X, 'Transformed Sequence: ') 1030 FORMAT(1X, 'Recovered Sequence: ') END SAMPLE OUTPUT Original Sequence: 1.000 0.966 0.866 0.707 0.500 0.259 Transformed Sequence: 6.000 0.000 0.000 0.000 0.000 0.000 Recovered Sequence: 24.000 23.182 20.785 16.971 12.000 6.212
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |