"Fossies" - the Fresh Open Source Software Archive 
Member "harminv-1.4.2/harminv-int.h" (6 Feb 2023, 2273 Bytes) of package /linux/privat/harminv-1.4.2.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "harminv-int.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
1.4.1_vs_1.4.2.
1 /* Copyright (C) 2017 Massachusetts Institute of Technology.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 #ifndef HARMINV_INT_H
19 #define HARMINV_INT_H 1
20
21 #include "config.h"
22
23 #ifndef __cplusplus
24 /* Require C99 complex number support; this is just too painful
25 without it. Alternatively, use the complex<double> STL class in
26 C++. */
27
28 #include <complex.h>
29 #endif
30
31 #include "harminv.h"
32
33 typedef harminv_complex cmplx; /* shortcut */
34
35 /* define extended precision (long double) cmplxl type */
36 #if defined(HAVE_LONG_DOUBLE) && !defined(__cplusplus)
37 #if defined(__cplusplus)
38 #include <complex>
39 typedef std::complex<long double> cmplxl; /* problematic w/some C++ comp's */
40
41 #elif defined(_Complex_I) && defined(complex) && defined(I)
42 /* C99 <complex.h> header was included before harminv.h */
43 typedef long double _Complex cmplxl;
44
45 #endif
46 #else
47 typedef cmplx cmplxl;
48 #endif
49
50 #ifdef __cplusplus
51 #define I cmplx(0, 1)
52 #define creal(c) real(c)
53 #define cimag(c) imag(c)
54 #define cabs(c) abs(c)
55 #define carg(c) arg(c)
56 #define cexp(c) exp(c)
57 #define csqrt(c) sqrt(c)
58 #define clog(c) log(c)
59 #else
60 #ifndef HAVE_CARG /* Cray doesn't have this for some reason */
61 #define carg(c) atan2(cimag(c), creal(c))
62 #endif
63 #endif
64
65 struct harminv_data_struct {
66 const cmplx *c;
67 int n, K, J, nfreqs;
68 double fmin, fmax;
69 cmplx *z;
70 cmplx *U0, *U1;
71 cmplxl *G0, *G0_M, *D0; /* cached G, G_M, and D arrays for U0 */
72 cmplx *B, *u; /* eigen-solutions of U1*B = u*U0*B */
73 cmplx *amps; /* mode amplitudes */
74 double *errs; /* relative "error" estimates */
75 };
76
77 #endif /* HARMINV_INT_H */