cscal3d,zscal3d(3F) cscal3d,zscal3d(3F)
cscal3d, zscal3d - scales a 3D complex sequence.
Fortran :
subroutine cscal3d( n1, n2, n3, alpha, array, la1, la2)
integer n1, n2, n3, la1, la2
real alpha
complex array(la1,la2,n3)
subroutine zscal3d( n1, n2, n3, alpha, array, la1, la2)
integer n1, n2, n3, la1, la2
real*8 alpha
double complex array(la1,la2,n3)
C :
#include <fft.h>
int cscal3d(int n1,int n2,int n3,float alpha,
complex *array,int la1, int la2);
int zscal3d(int n1,int n2,int n3,double alpha,
zomplex *array,int la1, int la2);
cscal3d and zscal3d scale a 3D complex sequence of size N1xN2xN3.
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 cscal3d or zscal3d may be used to scale back the
result.
N1 Integer, the first dimension size of the 3D sequence. Unchanged on
exit.
N2 Integer, the second dimension size of the 3D sequence. Unchanged on
exit.
N3 Integer, the thrid dimension size of the 3D sequence. Unchanged on
exit.
Alpha scaling floating point value.
ARRAY Array containing the samples of the 3D sequence to be transformed.
On input, the element {i,j,k} of the sequence is stored as A(i,j,k) in
Fortran , and A[i+j*la1+k*la1*la2] in C.
On exit, the array is overwritten.
LA1 Integer, first leading dimension: increment between the samples of
two consecutive 1D sub-sequences (e.g between {i,j+1,k} and {i,j,k} ).
Unchanged on exit.
Page 1
cscal3d,zscal3d(3F) cscal3d,zscal3d(3F)
LA2 Integer, second leading dimension: number of the 1D sub-sequence
between two consecutive 2D sub-sequences (e.g between {i,j,k+1} and
{i,j,k}). Unchanged on exit.
Example of Calling Sequence
Given a 3D complex sequence of size 100x64x125. We successively apply a
Direct Fourier Transform, an Inverse Fourier Transform and finally scale
back the result by a factor 1/N (1/(100x64x125))-
This succession DirectFFT-InverseFFT-Scaling is equivalent to the
identity operator and the final sequence should be equal (with round-off
precision) to the initial sequence.
The offset between the first element of two succesive sub-sequence
(leading dimension) is 2049.
Fortran
complex array(0:100-1,0:64-1,0:125-1)
real alpha
complex filter(0:100-1,0:64-1,0:125-1),
complex coeff(100+15 + 64+15 + 125+15)
call cfft3di( 100, 64, 125, coeff)
call cfft3d( -1,100,64,125,array,100,64,coeff)
call cfft3d( 1,100,64,125,array,100,64,coeff)
alpha = 1. / real(100x64x125)
call cscal3d( 100,64,125,alpha,array,100,64)
C
#include <fft.h>
complex array[100*64*125], *coeff;
float alpha;
coeff = cfft3di( 100, 64, 125, NULL);
cfft3d( -1,100,64,125,array,100,64,coeff);
cfft3d( 1,100,64,125,array,100,64,coeff);
alpha = 1. / (float)(100x64x125)
cscal3d( 100,64,125,alpha,array,100,64)
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, cfft3di, zfft3di, cfft3d, zfft3d, cprod3d, zprod3d
PPPPaaaaggggeeee 2222 [ Back ]
|