2121 'qnwsimp' , 'qnwtrap' , 'qnwunif' , 'quadrect' , 'qnwbeta' ,
2222 'qnwgamma' ]
2323
24+
2425@vectorize (nopython = True )
2526def gammaln (x ):
2627 return math .lgamma (x )
@@ -681,6 +682,7 @@ def _make_multidim_func(one_d_func, n, *args):
681682 nodes = gridmake (* nodes )
682683 return nodes , weights
683684
685+
684686@jit (nopython = True )
685687def _qnwcheb1 (n , a , b ):
686688 """
@@ -729,6 +731,7 @@ def _qnwcheb1(n, a, b):
729731
730732 return nodes , weights
731733
734+
732735@jit (nopython = True )
733736def _qnwlege1 (n , a , b ):
734737 """
@@ -784,9 +787,10 @@ def _qnwlege1(n, a, b):
784787 p2 = p1
785788 p1 = ((2 * j - 1 ) * z * p2 - (j - 1 ) * p3 ) / j
786789
790+ # https://github.com/QuantEcon/QuantEcon.py/issues/530
787791 top = n * (z * p1 - p2 )
788792 bottom = z ** 2 - 1.0
789- pp = top / bottom # https://github.com/QuantEcon/QuantEcon.py/issues/530
793+ pp = top / bottom
790794 z1 = z .copy ()
791795 z = z1 - p1 / pp
792796 if np .all (np .abs (z - z1 ) < 1e-14 ):
@@ -804,6 +808,7 @@ def _qnwlege1(n, a, b):
804808
805809 return nodes , weights
806810
811+
807812@jit (nopython = True )
808813def _qnwnorm1 (n ):
809814 """
@@ -882,6 +887,7 @@ def _qnwnorm1(n):
882887
883888 return nodes , weights
884889
890+
885891@jit (nopython = True )
886892def _qnwsimp1 (n , a , b ):
887893 """
@@ -930,6 +936,7 @@ def _qnwsimp1(n, a, b):
930936
931937 return nodes , weights
932938
939+
933940@jit (nopython = True )
934941def _qnwtrap1 (n , a , b ):
935942 """
@@ -977,6 +984,7 @@ def _qnwtrap1(n, a, b):
977984
978985 return nodes , weights
979986
987+
980988@jit (nopython = True )
981989def _qnwbeta1 (n , a = 1.0 , b = 1.0 ):
982990 """
@@ -1093,13 +1101,14 @@ def _qnwbeta1(n, a=1.0, b=1.0):
10931101 weights [i ] = temp / (pp * p2 )
10941102
10951103 nodes = (1 - nodes )/ 2
1096- weights = weights * math .exp (gammaln (a + n ) + gammaln (b + n )
1097- - gammaln (n + 1 ) - gammaln (n + ab + 1 ))
1098- weights = weights / (2 * math .exp (gammaln (a + 1 ) + gammaln (b + 1 )
1099- - gammaln (ab + 2 )))
1104+ weights = weights * math .exp (gammaln (a + n ) + gammaln (b + n ) -
1105+ gammaln (n + 1 ) - gammaln (n + ab + 1 ))
1106+ weights = weights / (2 * math .exp (gammaln (a + 1 ) + gammaln (b + 1 ) -
1107+ gammaln (ab + 2 )))
11001108
11011109 return nodes , weights
11021110
1111+
11031112@jit (nopython = True )
11041113def _qnwgamma1 (n , a = 1.0 , b = 1.0 , tol = 3e-14 ):
11051114 """
0 commit comments