@@ -46,18 +46,14 @@ typedef PDL_Long logical;
46
46
typedef PDL_Long integer;
47
47
typedef PDL_Long ftnlen;
48
48
49
- #ifdef __cplusplus
50
- typedef logical (*L_fp)(...);
51
- #else
52
- typedef logical (*L_fp)();
53
- #endif
54
-
55
- #ifndef min
56
- #define min(a,b) ((a) <= (b) ? (a) : (b))
57
- #endif
58
- #ifndef max
59
- #define max(a,b) ((a) >= (b) ? (a) : (b))
60
- #endif
49
+ #define DEF_SEL_FUNC(letter, letter2, args) \
50
+ void letter ## letter2 ## select_func_set(SV* func); \
51
+ logical letter ## letter2 ## select_wrapper args; \
52
+ typedef logical (*L_ ## letter ## letter2 ## p) args;
53
+ DEF_SEL_FUNC(f, , (float *wr, float *wi))
54
+ DEF_SEL_FUNC(d, , (double *wr, double *wi))
55
+ DEF_SEL_FUNC(f, g, (float *zr, float *zi, float *d))
56
+ DEF_SEL_FUNC(d, g, (double *zr, double *zi, double *d))
61
57
62
58
static integer c_zero = 0;
63
59
static integer c_nine = 9;
@@ -423,8 +419,8 @@ pp_def("gesdd",
423
419
$GENERIC() *work;
424
420
if (tra == \'N\'){
425
421
smlsiz = FORTRAN(ilaenv)(&c_nine, "SGESDD", " ", &c_zero, &c_zero, &c_zero, &c_zero, (ftnlen)6, (ftnlen)1);
426
- lwork = max (14*min ($SIZE(m),$SIZE(n))+4, 10*min ($SIZE(m),
427
- $SIZE(n))+2+ smlsiz*(smlsiz+8)) + max ($SIZE(m),$SIZE(n));
422
+ lwork = PDLMAX (14*PDLMIN ($SIZE(m),$SIZE(n))+4, 10*PDLMIN ($SIZE(m),
423
+ $SIZE(n))+2+ smlsiz*(smlsiz+8)) + PDLMAX ($SIZE(m),$SIZE(n));
428
424
}
429
425
work = ($GENERIC() *) malloc(lwork * sizeof($GENERIC()));
430
426
FORTRAN($TFD(s,d)gesdd)(
@@ -1664,13 +1660,6 @@ and rcondv, see section 4.11 of LAPACK User\'s Guide.
1664
1660
1665
1661
');
1666
1662
1667
- pp_addhdr('
1668
- void fselect_func_set(SV* func);
1669
- void dselect_func_set(SV* func);
1670
- PDL_Long fselect_wrapper(float *wr, float *wi);
1671
- PDL_Long dselect_wrapper(double *wr, double *wi);
1672
- ');
1673
-
1674
1663
pp_def("gees",
1675
1664
HandleBad => 0,
1676
1665
Pars => '[io]A(n,n); int jobvs(); int sort(); [o]wr(n); [o]wi(n); [o]vs(p,p); int [o]sdim(); int [o]info(); int [t]bwork(bworkn);',
@@ -1685,7 +1674,7 @@ pp_def("gees",
1685
1674
char psort = \'N\';
1686
1675
integer lwork = -1;
1687
1676
1688
- extern int FORTRAN($TFD(s,d)gees)(char *jobvs, char *sort, L_fp select, integer *n,
1677
+ extern int FORTRAN($TFD(s,d)gees)(char *jobvs, char *sort, L_$TFD(f,d)p select, integer *n,
1689
1678
$GENERIC() *a, integer *lda, integer *sdim, $GENERIC() *wr,
1690
1679
$GENERIC() *wi, $GENERIC() *vs, integer *ldvs, $GENERIC() *work,
1691
1680
integer *lwork, logical *bwork, integer *info);
@@ -1853,7 +1842,7 @@ pp_def("geesx",
1853
1842
integer liwork = 1;
1854
1843
integer *iwork;
1855
1844
char sens;
1856
- extern int FORTRAN($TFD(s,d)geesx)(char *jobvs, char *sort, L_fp select, char * sense,
1845
+ extern int FORTRAN($TFD(s,d)geesx)(char *jobvs, char *sort, L_$TFD(f,d)p select, char * sense,
1857
1846
integer *n, $GENERIC() *a, integer *lda, integer *sdim, $GENERIC() *wr,
1858
1847
$GENERIC() *wi, $GENERIC() *vs, integer *ldvs, $GENERIC() *rconde, $GENERIC() *rcondv,
1859
1848
$GENERIC() *work, integer *lwork, integer *iwork, integer *liwork,
@@ -2038,13 +2027,6 @@ the form
2038
2027
2039
2028
');
2040
2029
2041
- pp_addhdr('
2042
- void fgselect_func_set(SV* func);
2043
- void dgselect_func_set(SV* func);
2044
- PDL_Long fgselect_wrapper(float *zr, float *zi, float *d);
2045
- PDL_Long dgselect_wrapper(double *zr, double *zi, double *d);
2046
- ');
2047
-
2048
2030
pp_def("gges",
2049
2031
HandleBad => 0,
2050
2032
Pars => '[io]A(n,n); int jobvsl();int jobvsr();int sort();[io]B(n,n);[o]alphar(n);[o]alphai(n);[o]beta(n);[o]VSL(m,m);[o]VSR(p,p);int [o]sdim();int [o]info(); int [t]bwork(bworkn);',
@@ -2058,7 +2040,7 @@ pp_def("gges",
2058
2040
Code => generate_code '
2059
2041
integer lwork = -1;
2060
2042
char pjobvsl = \'N\', pjobvsr = \'N\', psort = \'N\';
2061
- extern int FORTRAN($TFD(s,d)gges)(char *jobvsl, char *jobvsr, char *sort, L_fp
2043
+ extern int FORTRAN($TFD(s,d)gges)(char *jobvsl, char *jobvsr, char *sort, L_$TFD(f,d)gp
2062
2044
delctg, integer *n, $GENERIC() *a, integer *lda, $GENERIC() *b,
2063
2045
integer *ldb, integer *sdim, $GENERIC() *alphar, $GENERIC() *alphai,
2064
2046
$GENERIC() *beta, $GENERIC() *vsl, integer *ldvsl, $GENERIC() *vsr,
@@ -2286,7 +2268,7 @@ pp_def("ggesx",
2286
2268
char psort = \'N\';
2287
2269
char psens = \'N\';
2288
2270
integer *iwork;
2289
- extern int FORTRAN($TFD(s,d)ggesx)(char *jobvsl, char *jobvsr, char *sort, L_fp
2271
+ extern int FORTRAN($TFD(s,d)ggesx)(char *jobvsl, char *jobvsr, char *sort, L_$TFD(f,d)gp
2290
2272
delctg, char *sense, integer *n, $GENERIC() *a, integer *lda, $GENERIC() *b,
2291
2273
integer *ldb, integer *sdim, $GENERIC() *alphar, $GENERIC() *alphai,
2292
2274
$GENERIC() *beta, $GENERIC() *vsl, integer *ldvsl, $GENERIC() *vsr,
@@ -2327,10 +2309,10 @@ pp_def("ggesx",
2327
2309
integer i__1 = maxwrk;
2328
2310
integer i__2 = minwrk + $SIZE(n) * (integer)FORTRAN(ilaenv)(&c__1, "DORGQR"
2329
2311
, " ", &(integer){$SIZE(n)}, &c__1, &(integer){$SIZE(n)}, &c_n1, (ftnlen)6, (ftnlen)1);
2330
- maxwrk = (integer ) max (i__1,i__2);
2312
+ maxwrk = (integer ) PDLMAX (i__1,i__2);
2331
2313
pjobvsl = \'V\';
2332
2314
}
2333
- lwork = (integer ) max (maxwrk,minwrk);
2315
+ lwork = (integer ) PDLMAX (maxwrk,minwrk);
2334
2316
2335
2317
{
2336
2318
$GENERIC() *work = ($GENERIC() *)malloc(lwork * sizeof($GENERIC()));
@@ -5492,7 +5474,6 @@ problem
5492
5474
# COMPUTATIONAL LEVEL ROUTINES
5493
5475
#
5494
5476
################################################################################
5495
- # TODO IPIV = min(m,n)
5496
5477
pp_def("getrf",
5497
5478
HandleBad => 0,
5498
5479
Pars => '[io]A(m,n); int [o]ipiv(p=CALC(PDLMIN($SIZE(m),$SIZE(n)))); int [o]info()',
0 commit comments