1
- /* f2c.h -- Standard Fortran to C header file */
2
-
3
- /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
4
-
5
- - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
6
-
7
- #ifndef F2C_INCLUDE
8
- #define F2C_INCLUDE
9
-
10
1
#include <math.h>
11
2
#include <stdlib.h>
12
3
#include <string.h>
19
10
#undef I
20
11
#endif
21
12
22
- typedef int integer ;
13
+ #if defined(_WIN64 )
14
+ typedef long long BLASLONG ;
15
+ typedef unsigned long long BLASULONG ;
16
+ #else
17
+ typedef long BLASLONG ;
18
+ typedef unsigned long BLASULONG ;
19
+ #endif
20
+
21
+ #ifdef LAPACK_ILP64
22
+ typedef BLASLONG blasint ;
23
+ #if defined(_WIN64 )
24
+ #define blasabs (x ) llabs(x)
25
+ #else
26
+ #define blasabs (x ) labs(x)
27
+ #endif
28
+ #else
29
+ typedef int blasint ;
30
+ #define blasabs (x ) abs(x)
31
+ #endif
32
+
33
+ typedef blasint integer ;
34
+
23
35
typedef unsigned int uinteger ;
24
36
typedef char * address ;
25
37
typedef short int shortint ;
26
38
typedef float real ;
27
39
typedef double doublereal ;
28
40
typedef struct { real r , i ; } complex ;
29
41
typedef struct { doublereal r , i ; } doublecomplex ;
42
+ #ifdef _MSC_VER
43
+ static inline _Fcomplex Cf (complex * z ) {_Fcomplex zz = {z -> r , z -> i }; return zz ;}
44
+ static inline _Dcomplex Cd (doublecomplex * z ) {_Dcomplex zz = {z -> r , z -> i };return zz ;}
45
+ static inline _Fcomplex * _pCf (complex * z ) {return (_Fcomplex * )z ;}
46
+ static inline _Dcomplex * _pCd (doublecomplex * z ) {return (_Dcomplex * )z ;}
47
+ #else
30
48
static inline _Complex float Cf (complex * z ) {return z -> r + z -> i * _Complex_I ;}
31
49
static inline _Complex double Cd (doublecomplex * z ) {return z -> r + z -> i * _Complex_I ;}
32
50
static inline _Complex float * _pCf (complex * z ) {return (_Complex float * )z ;}
33
51
static inline _Complex double * _pCd (doublecomplex * z ) {return (_Complex double * )z ;}
52
+ #endif
34
53
#define pCf (z ) (*_pCf(z))
35
54
#define pCd (z ) (*_pCd(z))
36
55
typedef int logical ;
@@ -170,8 +189,13 @@ typedef struct Namelist Namelist;
170
189
#define abort_ () { sig_die("Fortran abort routine called", 1); }
171
190
#define c_abs (z ) (cabsf(Cf(z)))
172
191
#define c_cos (R ,Z ) { pCf(R)=ccos(Cf(Z)); }
192
+ #ifdef _MSC_VER
193
+ #define c_div (c , a , b ) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
194
+ #define z_div (c , a , b ) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
195
+ #else
173
196
#define c_div (c , a , b ) {pCf(c) = Cf(a)/Cf(b);}
174
197
#define z_div (c , a , b ) {pCd(c) = Cd(a)/Cd(b);}
198
+ #endif
175
199
#define c_exp (R , Z ) {pCf(R) = cexpf(Cf(Z));}
176
200
#define c_log (R , Z ) {pCf(R) = clogf(Cf(Z));}
177
201
#define c_sin (R , Z ) {pCf(R) = csinf(Cf(Z));}
@@ -183,13 +207,13 @@ typedef struct Namelist Namelist;
183
207
#define d_atan (x ) (atan(*(x)))
184
208
#define d_atn2 (x , y ) (atan2(*(x),*(y)))
185
209
#define d_cnjg (R , Z ) { pCd(R) = conj(Cd(Z)); }
186
- #define r_cnjg (R , Z ) { pCf(R) = conj (Cf(Z)); }
210
+ #define r_cnjg (R , Z ) { pCf(R) = conjf (Cf(Z)); }
187
211
#define d_cos (x ) (cos(*(x)))
188
212
#define d_cosh (x ) (cosh(*(x)))
189
213
#define d_dim (__a , __b ) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
190
214
#define d_exp (x ) (exp(*(x)))
191
215
#define d_imag (z ) (cimag(Cd(z)))
192
- #define r_imag (z ) (cimag (Cf(z)))
216
+ #define r_imag (z ) (cimagf (Cf(z)))
193
217
#define d_int (__x ) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
194
218
#define r_int (__x ) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
195
219
#define d_lg10 (x ) ( 0.43429448190325182765 * log(*(x)) )
@@ -228,11 +252,11 @@ static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
228
252
#define z_exp (R , Z ) {pCd(R) = cexp(Cd(Z));}
229
253
#define z_sqrt (R , Z ) {pCd(R) = csqrt(Cd(Z));}
230
254
#define myexit_ () break;
231
- #define mycycle_ () continue;
232
- #define myceiling_ (w ) ceil(w)
233
- #define myhuge_ (w ) HUGE_VAL
255
+ #define mycycle () continue;
256
+ #define myceiling (w ) { ceil(w)}
257
+ #define myhuge (w ) { HUGE_VAL}
234
258
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
235
- #define mymaxloc_ (w ,s ,e ,n ) dmaxloc_(w,*(s),*(e),n)
259
+ #define mymaxloc (w ,s ,e ,n ) { dmaxloc_(w,*(s),*(e),n)}
236
260
237
261
/* procedure parameter types for -A and -C++ */
238
262
@@ -267,6 +291,21 @@ static double dpow_ui(double x, integer n) {
267
291
}
268
292
return pow ;
269
293
}
294
+ #ifdef _MSC_VER
295
+ static _Fcomplex cpow_ui (complex x , integer n ) {
296
+ complex pow = {1.0 ,0.0 }; unsigned long int u ;
297
+ if (n != 0 ) {
298
+ if (n < 0 ) n = - n , x .r = 1 /x .r , x .i = 1 /x .i ;
299
+ for (u = n ; ; ) {
300
+ if (u & 01 ) pow .r *= x .r , pow .i *= x .i ;
301
+ if (u >>= 1 ) x .r *= x .r , x .i *= x .i ;
302
+ else break ;
303
+ }
304
+ }
305
+ _Fcomplex p = {pow .r , pow .i };
306
+ return p ;
307
+ }
308
+ #else
270
309
static _Complex float cpow_ui (_Complex float x , integer n ) {
271
310
_Complex float pow = 1.0 ; unsigned long int u ;
272
311
if (n != 0 ) {
@@ -279,6 +318,22 @@ static _Complex float cpow_ui(_Complex float x, integer n) {
279
318
}
280
319
return pow ;
281
320
}
321
+ #endif
322
+ #ifdef _MSC_VER
323
+ static _Dcomplex zpow_ui (_Dcomplex x , integer n ) {
324
+ _Dcomplex pow = {1.0 ,0.0 }; unsigned long int u ;
325
+ if (n != 0 ) {
326
+ if (n < 0 ) n = - n , x ._Val [0 ] = 1 /x ._Val [0 ], x ._Val [1 ] = 1 /x ._Val [1 ];
327
+ for (u = n ; ; ) {
328
+ if (u & 01 ) pow ._Val [0 ] *= x ._Val [0 ], pow ._Val [1 ] *= x ._Val [1 ];
329
+ if (u >>= 1 ) x ._Val [0 ] *= x ._Val [0 ], x ._Val [1 ] *= x ._Val [1 ];
330
+ else break ;
331
+ }
332
+ }
333
+ _Dcomplex p = {pow ._Val [0 ], pow ._Val [1 ]};
334
+ return p ;
335
+ }
336
+ #else
282
337
static _Complex double zpow_ui (_Complex double x , integer n ) {
283
338
_Complex double pow = 1.0 ; unsigned long int u ;
284
339
if (n != 0 ) {
@@ -291,6 +346,7 @@ static _Complex double zpow_ui(_Complex double x, integer n) {
291
346
}
292
347
return pow ;
293
348
}
349
+ #endif
294
350
static integer pow_ii (integer x , integer n ) {
295
351
integer pow ; unsigned long int u ;
296
352
if (n <= 0 ) {
@@ -324,6 +380,22 @@ static integer smaxloc_(float *w, integer s, integer e, integer *n)
324
380
}
325
381
static inline void cdotc_ (complex * z , integer * n_ , complex * x , integer * incx_ , complex * y , integer * incy_ ) {
326
382
integer n = * n_ , incx = * incx_ , incy = * incy_ , i ;
383
+ #ifdef _MSC_VER
384
+ _Fcomplex zdotc = {0.0 , 0.0 };
385
+ if (incx == 1 && incy == 1 ) {
386
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387
+ zdotc ._Val [0 ] += conjf (Cf (& x [i ]))._Val [0 ] * Cf (& y [i ])._Val [0 ];
388
+ zdotc ._Val [1 ] += conjf (Cf (& x [i ]))._Val [1 ] * Cf (& y [i ])._Val [1 ];
389
+ }
390
+ } else {
391
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392
+ zdotc ._Val [0 ] += conjf (Cf (& x [i * incx ]))._Val [0 ] * Cf (& y [i * incy ])._Val [0 ];
393
+ zdotc ._Val [1 ] += conjf (Cf (& x [i * incx ]))._Val [1 ] * Cf (& y [i * incy ])._Val [1 ];
394
+ }
395
+ }
396
+ pCf (z ) = zdotc ;
397
+ }
398
+ #else
327
399
_Complex float zdotc = 0.0 ;
328
400
if (incx == 1 && incy == 1 ) {
329
401
for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
@@ -336,8 +408,25 @@ static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, c
336
408
}
337
409
pCf (z ) = zdotc ;
338
410
}
411
+ #endif
339
412
static inline void zdotc_ (doublecomplex * z , integer * n_ , doublecomplex * x , integer * incx_ , doublecomplex * y , integer * incy_ ) {
340
413
integer n = * n_ , incx = * incx_ , incy = * incy_ , i ;
414
+ #ifdef _MSC_VER
415
+ _Dcomplex zdotc = {0.0 , 0.0 };
416
+ if (incx == 1 && incy == 1 ) {
417
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418
+ zdotc ._Val [0 ] += conj (Cd (& x [i ]))._Val [0 ] * Cd (& y [i ])._Val [0 ];
419
+ zdotc ._Val [1 ] += conj (Cd (& x [i ]))._Val [1 ] * Cd (& y [i ])._Val [1 ];
420
+ }
421
+ } else {
422
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423
+ zdotc ._Val [0 ] += conj (Cd (& x [i * incx ]))._Val [0 ] * Cd (& y [i * incy ])._Val [0 ];
424
+ zdotc ._Val [1 ] += conj (Cd (& x [i * incx ]))._Val [1 ] * Cd (& y [i * incy ])._Val [1 ];
425
+ }
426
+ }
427
+ pCd (z ) = zdotc ;
428
+ }
429
+ #else
341
430
_Complex double zdotc = 0.0 ;
342
431
if (incx == 1 && incy == 1 ) {
343
432
for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
@@ -349,9 +438,26 @@ static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integ
349
438
}
350
439
}
351
440
pCd (z ) = zdotc ;
352
- }
441
+ }
442
+ #endif
353
443
static inline void cdotu_ (complex * z , integer * n_ , complex * x , integer * incx_ , complex * y , integer * incy_ ) {
354
444
integer n = * n_ , incx = * incx_ , incy = * incy_ , i ;
445
+ #ifdef _MSC_VER
446
+ _Fcomplex zdotc = {0.0 , 0.0 };
447
+ if (incx == 1 && incy == 1 ) {
448
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449
+ zdotc ._Val [0 ] += Cf (& x [i ])._Val [0 ] * Cf (& y [i ])._Val [0 ];
450
+ zdotc ._Val [1 ] += Cf (& x [i ])._Val [1 ] * Cf (& y [i ])._Val [1 ];
451
+ }
452
+ } else {
453
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454
+ zdotc ._Val [0 ] += Cf (& x [i * incx ])._Val [0 ] * Cf (& y [i * incy ])._Val [0 ];
455
+ zdotc ._Val [1 ] += Cf (& x [i * incx ])._Val [1 ] * Cf (& y [i * incy ])._Val [1 ];
456
+ }
457
+ }
458
+ pCf (z ) = zdotc ;
459
+ }
460
+ #else
355
461
_Complex float zdotc = 0.0 ;
356
462
if (incx == 1 && incy == 1 ) {
357
463
for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
@@ -364,8 +470,25 @@ static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, c
364
470
}
365
471
pCf (z ) = zdotc ;
366
472
}
473
+ #endif
367
474
static inline void zdotu_ (doublecomplex * z , integer * n_ , doublecomplex * x , integer * incx_ , doublecomplex * y , integer * incy_ ) {
368
475
integer n = * n_ , incx = * incx_ , incy = * incy_ , i ;
476
+ #ifdef _MSC_VER
477
+ _Dcomplex zdotc = {0.0 , 0.0 };
478
+ if (incx == 1 && incy == 1 ) {
479
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480
+ zdotc ._Val [0 ] += Cd (& x [i ])._Val [0 ] * Cd (& y [i ])._Val [0 ];
481
+ zdotc ._Val [1 ] += Cd (& x [i ])._Val [1 ] * Cd (& y [i ])._Val [1 ];
482
+ }
483
+ } else {
484
+ for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485
+ zdotc ._Val [0 ] += Cd (& x [i * incx ])._Val [0 ] * Cd (& y [i * incy ])._Val [0 ];
486
+ zdotc ._Val [1 ] += Cd (& x [i * incx ])._Val [1 ] * Cd (& y [i * incy ])._Val [1 ];
487
+ }
488
+ }
489
+ pCd (z ) = zdotc ;
490
+ }
491
+ #else
369
492
_Complex double zdotc = 0.0 ;
370
493
if (incx == 1 && incy == 1 ) {
371
494
for (i = 0 ;i < n ;i ++ ) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
@@ -386,6 +509,7 @@ static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integ
386
509
387
510
388
511
512
+
389
513
/* Table of constant values */
390
514
391
515
static integer c__1 = 1 ;
0 commit comments