sscal2d,dscal2d(3F) sscal2d,dscal2d(3F)
sscal2d, dscal2d - scales 2D real sequence.
Fortran :
subroutine sscal2d( n1, n2, alpha, array, lda)
integer n1, n2, lda
real alpha, array(lda,n2)
subroutine dscal2d( n1, n2, alpha, array, lda)
integer n1, n2, lda
real*8 alpha, array(lda,n2)
C :
#include <fft.h>
int sscal2d(int n1,int n2,float alpha,
float *array,int lda);
int dscal2d(int n1,int n2,double alpha,
double *array,int lda);
sscal2d and dscal2d scale the 2D real sequence of N1xN2 sample.
The Fourier Transforms are not normalized so the succession DirectInverse
transform scales the input data by a factor equal to the size of
the transform. So sscal2d or dscal2d may be used to scale back the
result.
N1 Integer, the first dimension size of the 2D sequence.
Unchanged on exit.
N2 Integer, the second dimension size of the 2D sequence.
Unchanged on exit.
Alpha scaling floating point value.
ARRAY Array containing the samples of the 2D sequence to be transformed.
On input, the element {i,j} of the sequence is stored as A(i,j) in
Fortran , and A[i+j*lda] in C.
On exit, the array is overwritten by its transform.
LDA Integer, leading dimension: increment between the samples of two
consecutive sub-sequences (e.g between {i,j+1} and {i,j} ).
Unchanged on exit.
Example of Calling Sequence
Working on 64x1024 2D sequence. We successively apply a Direct Fourier
Transform, an Inverse Fourier Transform and finally scale back the result
by a factor 1/N (1/(64*1024.))-
This sequence DirectFFT-InverseFFT-Scaling is equivalent to the identity
operator and the final sequence should be equal (with round-off
Page 1
sscal2d,dscal2d(3F) sscal2d,dscal2d(3F)
precision) to the initial sequence.
The offset between the first element of two succesive sub-sequence
(leading dimension) is 1026 (1026 >= 1024+2).
Fortran
real array(0:1026-1,0:64-1), coeff((1024+15)+2*(64+15))
call scfft2dui( 1024, 64, coeff)
call scfft2du( -1, 1024, 64, array, 1026, coeff)
call csfft2du( 1, 1024, 64, array, 1026, coeff)
call sscal2d(1024,64,(1./real(1024*64)),array,1026)
C
#include <fft.h>
float array[64*1026], *coeff;
coeff = scfft2dui( 1024, 64, NULL);
scfft2du( -1, 1024, 64, array, 1026, coeff);
csfft2du( 1, 1024, 64, array, 1026, coeff);
sscal2d( 1024,64,1./(float)(1024*64),array,1026);
NOTE_1 : The Direct and Inverse transforms should use opposite signs -
Which one is used (+1 or -1) for Direct transform is just a matter of
convention
NOTE_2 : The Fourier Transforms are not normalized so the succession
Direct-Inverse transform scales the input data by a factor equal to the
size of the transform.
fft, scfft2dui, dzfft2dui, scfft2du, dzfft2du, csfft2du, zdfft2du,
sprod2du, dprod2du
PPPPaaaaggggeeee 2222 [ Back ]
|