NAME dcosqf - compute the Fourier coefficients in a cosine series representation with only odd wave numbers. The xCOSQ opera- tions are unnormalized inverses of themselves, so a call to xCOSQF followed by a call to xCOSQB will multiply the input sequence by 4 * N. The VxCOSQ operations are normalized, so a call of VxCOSQF followed by a call of VxCOSQB will return the original sequence. SYNOPSIS SUBROUTINE COSQF (N, RX, RWSAVE) SUBROUTINE DCOSQF (N, DX, RWSAVE) SUBROUTINE VCOSQF (M, N, RX, RXT, MDIMX, RWSAVE) SUBROUTINE VDCOSQF (M, N, DX, DXT, MDIMX, DWSAVE) #include <sunperf.h> void cosqf (int n, float *sx, float *wsave) ; void dcosqf (int n, double *dx, double *wsave) ; void vcosqf(int m, int n, float *sx, int mdimx, float *wsave) ; void vdcosqf(int m, int n, double *dx, int mdimx, double *wsave) ; ARGUMENTS M (For vector operations only.) The number of sequences to be transformed. M >= 0. N Length of the sequence to be transformed. These subroutines are most efficient when N is a product of small primes. N >= 0. xX On entry, an array of length N containing the sequence to be transformed. For VxCOSQF, a real two-dimensional array with dimensions of (MDIMX x N) whose rows contain the sequences to be transformed. On exit, the quarter-wave cosine transform of the input. xXT (For vector operations only.) A real two-dimensional work array with dimensions of (MDIMX x N). MDIMX (For vector operations only.) Leading dimension of the arrays xX and xXT as specified in a dimension or type statement. MDIMX >= M. xWSAVE On entry, an array with dimension of at least (3 * N + 15) for scalar subroutines or (2 * N + 15) for vector subroutines, initialized by xCOSTI or VxCOSTI. SAMPLE PROGRAM PROGRAM TEST IMPLICIT NONE C INTEGER M, N PARAMETER (M = 4) PARAMETER (N = 6) C INTEGER I, J REAL PI, WSAVE(N + 15), X(M, N), XT(M, N) C EXTERNAL VCOSQB, VCOSQF, VCOSQI INTRINSIC ACOS, COS C C Initialize the array to m real even quarter-wave sequences, C that is, they can be expanded in terms of a cosine series with C only odd wave numbers. C PI = ACOS (-1.0) DO 110, J=1, M DO 100, I=1, N X(J,I) = 40.0 * J * COS ((I-1) * PI / 2.0 / N ) 100 CONTINUE 110 CONTINUE C CALL VCOSQI (N, WSAVE) PRINT 1000 DO 120, J=1, M PRINT 1010, J, (X(J, I), I = 1, N) 120 CONTINUE CALL VCOSQF (M, N, X, XT, M, WSAVE) PRINT 1020 DO 130, J=1, M PRINT 1010, J, (X(J, I), I = 1, N) 130 CONTINUE CALL VCOSQB (M, N, X, XT, M, WSAVE) PRINT 1030 DO 140, J=1, M PRINT 1010, J, (X(J, I), I = 1, N) 140 CONTINUE C 1000 FORMAT (1X, 'Original Sequence: ') 1010 FORMAT(1X, 'Sequence', I2, ': ', 100(F5.1, 1X)) 1020 FORMAT (1X, 'Transformed Sequence: ') 1030 FORMAT (1X, 'Recovered Sequence: ') C END SAMPLE OUTPUT Original Sequence: Sequence 1: 40.0 38.6 34.6 28.3 20.0 10.4 Sequence 2: 80.0 77.3 69.3 56.6 40.0 20.7 Sequence 3: 120.0 115.9 103.9 84.9 60.0 31.1 Sequence 4: 160.0 154.5 138.6 113.1 80.0 41.4 Transformed Sequence: Sequence 1: 49.0 0.0 0.0 0.0 0.0 0.0 Sequence 2: 98.0 0.0 0.0 0.0 0.0 0.0 Sequence 3: 147.0 0.0 0.0 0.0 0.0 0.0 Sequence 4: 196.0 0.0 0.0 0.0 0.0 0.0 Recovered Sequence: Sequence 1: 40.0 38.6 34.6 28.3 20.0 10.4 Sequence 2: 80.0 77.3 69.3 56.6 40.0 20.7 Sequence 3: 120.0 115.9 103.9 84.9 60.0 31.1 Sequence 4: 160.0 154.5 138.6 113.1 80.0 41.4
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |