VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fftlib.h
Go to the documentation of this file.
1 /* © 1998 JRM Technologies, Inc.*/
2 /***********************************************************
3 Copyright JRM Enterprises, Inc. 1998
4 All rights reserved.
5 
6 This code is the intellectual property of JRM Enteprises, Inc.
7 developed for the Institute for Defense Analysis (IDA).
8 
9 JRM Enterprises, Inc. grants the Insitute for Defense Analysis
10 the right to use and distribute this code as necessary for
11 Government purposes.
12 
13 No third party may use or distribute this code without
14 prior written consent of JRM Enterprises, Inc. or Institute
15 for Defense Analysis.
16 ************************************************************/
17 
18 #ifndef _JRMLIBRARY_FFTLIB_H_
19 #define _JRMLIBRARY_FFTLIB_H_
20 
21 #include "JRMlibrary.h"
22 #include "JRMlibraryDLLstub.h"
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 
30 #define c_re(c) ((c).re)
31 #define c_im(c) ((c).im)
32 
33  /*
34  * C_add_mul adds product of c1 and c2 to c.
35  */
36 #define c_add_mul(c, c1, c2) { COMPLEX C1, C2; C1 = (c1); C2 = (c2); c_re (c) += C1.re * C2.re - C1.im * C2.im; c_im (c) += C1.re * C2.im + C1.im * C2.re; }
37 
38  /*
39  * C_conj substitutes c by its complex conjugate.
40  */
41 #define c_conj(c) { c_im (c) = -c_im (c); }
42 
43  /*
44  * C_realdiv divides complex c by real.
45  */
46 #define c_realdiv(c, real) { c_re (c) /= (real); c_im (c) /= (real); }
47 
49  JRMLIBRARY_API extern unsigned Nfactors;
50 
51 
55  JRMLIBRARY_API int AddCOMPLEXArrays(COMPLEX *a, COMPLEX *b, COMPLEX *out, unsigned int nelements);
56 
57  /*
58  -------------------------------------------------------------------------
59  1D FFT
60  -------------------------------------------------------------------------
61  */
62 
63 
64  JRMLIBRARY_API long W_init (unsigned n);
65  JRMLIBRARY_API void Fourier (COMPLEX *in, unsigned n, COMPLEX *out);
66  JRMLIBRARY_API extern long fft (COMPLEX *in, unsigned n, COMPLEX *out);
67  JRMLIBRARY_API extern long fftp (COMPLEX *in, unsigned n, COMPLEX *out);
68  JRMLIBRARY_API extern long rft (COMPLEX *in, unsigned n, COMPLEX *out);
69  JRMLIBRARY_API extern long rftp (COMPLEX *in, unsigned n, COMPLEX *out);
70  JRMLIBRARY_API extern long prime_factor(long n);
71  //JRMLIBRARY_API extern long *all_factors(long n, long *count);
72  JRMLIBRARY_API extern long next_best(long n, long lpfa);
73  JRMLIBRARY_API short dft(COMPLEX *array, long npts, COMPLEX *work, long dir);
74 
75  // NOTE : frequency and width inputs to the routines below must be in [#cycles per time interval between array elements], = [#cycles/sec]*[delta-t = sec/interval]
76  JRMLIBRARY_API int LowPassFilter(COMPLEX *in, unsigned int nin, COMPLEX *out, double kneefreq, double attenuation);
77  JRMLIBRARY_API int BandPassFilter(COMPLEX *in, unsigned int nin, COMPLEX *out, double centerfreq, double passwidth, double attenuation);
78  JRMLIBRARY_API int LocalOscillator(COMPLEX *out, unsigned int nout, double freq, double amplitude);
79 
80 
81  /*
82  -------------------------------------------------------------------------
83  2D FFT
84  -------------------------------------------------------------------------
85  */
86 
87  JRMLIBRARY_API extern long fft2d(COMPLEX *array, long ncols, long nrows, long dirflag, char printflag);
88  JRMLIBRARY_API extern long xfmrows(COMPLEX *array, long ncols, long nrows, long dirflag);
89  JRMLIBRARY_API extern long xfmcols(COMPLEX *array, long ncols, long nrows, long dirflag);
90 
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif // _JRMLIBRARY_FFTLIB_H_


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)