Skip to content

Commit 6086fd7

Browse files
committed
RFC: Fix PEP8 errors
1 parent 5c37da7 commit 6086fd7

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

quantecon/optimize/nelder_mead.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ def _nelder_mead_algorithm(fun, vertices, bounds=np.array([[], []]).T,
232232

233233
# Step 3: Expansion
234234
elif f_r < f_val[best_val_idx]:
235-
temp = χ * (x_r - x_bar) # https://github.com/QuantEcon/QuantEcon.py/issues/530
235+
# https://github.com/QuantEcon/QuantEcon.py/issues/530
236+
temp = χ * (x_r - x_bar)
236237
x_e = x_bar + temp
237238
f_e = _neg_bounded_fun(fun, bounds, x_e, args=args)
238239
if f_e < f_r: # Greedy minimization

quantecon/quad.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'qnwsimp', 'qnwtrap', 'qnwunif', 'quadrect', 'qnwbeta',
2222
'qnwgamma']
2323

24+
2425
@vectorize(nopython=True)
2526
def 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)
685687
def _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)
733736
def _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)
808813
def _qnwnorm1(n):
809814
"""
@@ -882,6 +887,7 @@ def _qnwnorm1(n):
882887

883888
return nodes, weights
884889

890+
885891
@jit(nopython=True)
886892
def _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)
934941
def _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)
981989
def _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)
11041113
def _qnwgamma1(n, a=1.0, b=1.0, tol=3e-14):
11051114
"""

0 commit comments

Comments
 (0)