Package: pdl / 1:2.019-5

slatec_default_integer_8.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Description: Use 64bit integers in Slatec module.
 For the time being, always use 64bit integers in Fortran libs
 slatec and minuit by default, as Debian perl packages switched
 to ivsize=8 on all arches, implying a 64bit index type in PDL.
Author: Henning Glawe <glaweh@debian.org>
Forwarded: https://sourceforge.net/p/pdl/patches/84/

--- a/Lib/Slatec/slatec.pd
+++ b/Lib/Slatec/slatec.pd
@@ -364,7 +364,7 @@ sub defslatec {
 	  (($_->[0] eq "Mat" or $_->[0] eq "FuncRet")
            and join '',@{$_}[1,2,3]) or
 	  (($_->[0] eq "IntFlag" or $_->[0] eq "FortranIndex" or $_->[0] eq "CheckFlag")
-           and "int ".join '',@{$_}[1,2,3]) or
+           and "longlong ".join '',@{$_}[1,2,3]) or
 	  die "Invalid ppars ",(join ',',@$_),"\n";
       }
     } @args2;
@@ -412,12 +412,12 @@ sub defslatec {
     my @ifincode;
     foreach ( @args2 ) {
       if ( $_->[0] eq "Incfd" ) {
-	  push @ifincode, "int _" . lc($_->[0]) . " = 1;";
+	  push @ifincode, "long long _" . lc($_->[0]) . " = 1;";
       } elsif ( $_->[0] eq "CheckFlag" ) {
-	  push @ifincode, "int _" . lc($_->[0]) . " = \$$_->[2]();";
+	  push @ifincode, "long long _" . lc($_->[0]) . " = \$$_->[2]();";
       } elsif ( $_->[0] eq "FortranIndex" ) {
 	  # convert from C to F77 index
-	  push @ifincode, "int _$_->[2] = \$$_->[2]() + 1;"
+	  push @ifincode, "long long _$_->[2] = \$$_->[2]() + 1;"
       }
     }
 
@@ -498,7 +498,7 @@ sub PDL::eigsys {
 	$h = float($h);
 	rs($h, 
 		(my $eigval=PDL->null),
-		(long (pdl (1))),(my $eigmat=PDL->null),
+		(longlong (pdl (1))),(my $eigmat=PDL->null),
 		(my $fvone = PDL->null),(my $fvtwo = PDL->null),
 		(my $errflag=PDL->null)
 	);
@@ -524,7 +524,7 @@ sub PDL::matinv {
 	if(sum($info) > 0) {
 		barf("Uninvertible matrix given to inv: $m\n");
 	}
-	gedi($m,$ipvt,(pdl 0,0),(null),(long( pdl (1))));
+	gedi($m,$ipvt,(pdl 0,0),(null),(longlong( pdl (1))));
 	$m;
 }
 
@@ -536,7 +536,7 @@ sub PDL::detslatec {
 	if(sum($info) > 0) {
 		barf("Uninvertible matrix given to inv: $m\n");
 	}
-	gedi($m,$ipvt,(my $det=null),(null),(long( pdl (10))));
+	gedi($m,$ipvt,(my $det=null),(null),(longlong( pdl (10))));
 	return $det->slice('(0)')*10**$det->slice('(1)');
 }
 
@@ -1569,12 +1569,12 @@ Error status returned by C<$ierr>:
 #  bar runs across polynomial coefficients.
 #
 pp_def('polfit',
-  Pars => 'x(n); y(n); w(n); int maxdeg(); int [o]ndeg(); [o]eps(); [o]r(n); int [o]ierr(); [o]a(foo); [o]coeffs(bar);[t]xtmp(n);[t]ytmp(n);[t]wtmp(n);[t]rtmp(n)',
+  Pars => 'x(n); y(n); w(n); longlong maxdeg(); longlong [o]ndeg(); [o]eps(); [o]r(n); longlong [o]ierr(); [o]a(foo); [o]coeffs(bar);[t]xtmp(n);[t]ytmp(n);[t]wtmp(n);[t]rtmp(n)',
   OtherPars => '',
   Code => '
-           int maxord;
-           int ord;
-           int k;
+           long long maxord;
+           long long ord;
+           long long k;
            $GENERIC() zero = 0;
 
            $TFD(polfit'.$uscore.',dpolft'.$uscore.')  (&$PRIV(__n_size),$P(x),$P(y),$P(w),$P(maxdeg),$P(ndeg),$P(eps),$P(r),$P(ierr),$P(a)); 
@@ -1590,9 +1590,9 @@ pp_def('polfit',
   GenericTypes => ['F','D'],
   HandleBad => 1, 
   NoBadifNaN => 1,
-  BadCode => 'int ns = $SIZE(n);
-              int i;
-	      int j = 0; 
+  BadCode => 'long long ns = $SIZE(n);
+              long long i;
+	      long long j = 0;
               if($SIZE(n)<$maxdeg()) {
                 barf("polfit: Must have at least <n> points to fit <n> coefficients");
               }
@@ -1613,9 +1613,9 @@ pp_def('polfit',
                 $ierr() = 2;
               } else {
                   /* Found enough good datapoints for a fit -- do the fit */
-		  int k;
-		  int ord;
-		  int maxord;
+		  long long k;
+		  long long ord;
+		  long long maxord;
                   $GENERIC() zero = 0;
 
                 /* Do the fit */
--- a/t/slatec.t
+++ b/t/slatec.t
@@ -240,7 +240,8 @@ my $ismon;
 ( $ismon, $err ) = chcm($x, $f, $d, 1);
 
 ok(($err->getndims==0) & ($err->sum == 0));
-ok($ismon->get_datatype == 3);
+# HG: datatype has been forced to longlong
+ok($ismon->get_datatype == 5);
 ok(tapprox($ismon,$ans));
 
 ## Test: chia