Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

cfft2b(3P)

NAME

cfft2b - compute a periodic sequence from its Fourier coefficients.  The xFFT operations are unnormalized, so a call of xFFT2F followed by a call of xFFT2B will multiply the input sequence by M∗N. 

SYNOPSIS

SUBROUTINE RFFT2B (PLACE, M, N, RX, LDX, RY, LDY, RWSAVE, LWSAVE)

SUBROUTINE DFFT2B (PLACE, M, N, DX, LDX, DY, LDY, DWSAVE, LWSAVE)

SUBROUTINE CFFT2B (M, N, CX, LDX, RWSAVE, LWSAVE)

SUBROUTINE ZFFT2B (M, N, ZX, LDX, DWSAVE, LWSAVE)

 

#include <sunperf.h>

void rfft2b (char place, int m, int n, float ∗rx, int ldx, float ∗ry, int ldy, float ∗wsave, int lwsave);

void dfft2b (char place, int m, int n, double ∗ry, int ldx, double ∗wsave, int lwsave);

void cfft2b (int m, int n, complex ∗cx, int ldx, complex ∗wsave, int lwsave);

void zfft2b (int m, int n, doublecomplex ∗zx, int ldx, doublecomplex ∗wsave, int lwsave);

ARGUMENTS

PLACE Determines whether an in-place or out-of-place transform is to be performed.  ’I’ or ’i’ if an in-place transform is to be performed, ’O’ or ’o’ if an out-of-place transform is to be performed. 

M Number of rows to be transformed.  These subroutines are most efficient when M is a product of small primes.  M >= 0. 

N Number of columns to be transformed.  These subroutines are most efficient when N is a product of small primes.  N >= 0. 

xX On entry, a two-dimensional array xX(M,N) that contains the sequences to be transformed. 

LDX Leading dimension of the array containing the data to be transformed.  LDX >= M. 

xY On entry, the data to be transformed if PLACE is ’O’ or ’o’, otherwise this argument is ignored.  Undefined on exit. 

LDY Leading dimension of the array containing the data to be transformed in the out-of-place transform case.  LDX >= M. 

xWSAVE On entry, an array with dimension of at least LWSAVE.  xWSAVE must have been initialized by xFFT2I. 

LWSAVE Length of WSAVE.  LWSAVE >= (M+N+MAX(M,N)+45) for real inputs or LWSAVE >= (2∗(M+N+MAX(M,N)+45) for complex inputs. 

SAMPLE PROGRAM

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LWSAVE, M, N
      PARAMETER        (LWSAVE = 4 ∗ (M + N + K) + 45)
      PARAMETER        (M = 2)
      PARAMETER        (N = 4)
C
      INTEGER           I, J
      REAL              PI, WSAVE(LWSAVE)
      REAL              X, Y
      COMPLEX           C(M,N)
C
      EXTERNAL          CFFT2B, CFFT2F, CFFT2I
      INTRINSIC         ACOS, CMPLX, COS, SIN
C
C     Initialize the array C to a complex sequence.
C
      PI = ACOS (-1.0)
      DO 110, J = 1, N
        DO 100, I = 1, M
          X = SIN ((I - 1.0) ∗ 2.0 ∗ PI / N)
          Y = COS ((J - 1.0) ∗ 2.0 ∗ PI / M)
          C(I,J) = CMPLX (X, Y)
  100   CONTINUE
  110 CONTINUE
C
      PRINT 1000
      DO 200, I = 1, M
        PRINT 1010, (C(I,J), J = 1, N)
  200 CONTINUE
      CALL CFFT2I (M, N, WSAVE)
      CALL CFFT2F (M, N, C, M, WSAVE, LWSAVE)
      PRINT 1020
      DO 300, I = 1, M
        PRINT 1010, (C(I,J), J = 1, N)
  300 CONTINUE
      CALL CFFT2B (M, N, C, M, WSAVE, LWSAVE)
      PRINT 1030
      DO 400, I = 1, M
        PRINT 1010, (C(I,J), J = 1, N)
  400 CONTINUE
C
 1000 FORMAT (1X, ’Original Sequences:’)
 1010 FORMAT (1X, 100(F4.1’ +’,F4.1,’i  ’))
 1020 FORMAT (1X, ’Transformed Sequences:’)
 1030 FORMAT (1X, ’Recovered Sequences:’)
C
      END

SAMPLE OUTPUT

 
  0.0 + 1.0i   0.0 +-1.0i   0.0 + 1.0i   0.0 +-1.0i
  1.0 + 1.0i   1.0 +-1.0i   1.0 + 1.0i   1.0 +-1.0i
 Transformed Sequences:
  4.0 + 0.0i   0.0 + 0.0i   0.0 + 8.0i   0.0 + 0.0i
 -4.0 + 0.0i   0.0 + 0.0i   0.0 + 0.0i   0.0 + 0.0i
 Recovered Sequences:
  0.0 + 8.0i   0.0 +-8.0i   0.0 + 8.0i   0.0 +-8.0i
  8.0 + 8.0i   8.0 +-8.0i   8.0 + 8.0i   8.0 +-8.0i

SunOS WorkShop_5.0  —  Last change: 10 Dec 1998

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026