@@ -1400,7 +1400,7 @@ def linspace(lo, hi, n):
1400
1400
width = (hi - lo ) / (n - 1 )
1401
1401
return [lo + width * i for i in range (n )]
1402
1402
1403
- def GenDot (n , c = 1e12 ):
1403
+ def GenDot (n , c ):
1404
1404
""" Algorithm 6.1 (GenDot) works as follows. The condition number (5.7) of
1405
1405
the dot product xT y is proportional to the degree of cancellation. In
1406
1406
order to achieve a prescribed cancellation, we generate the first half of
@@ -1443,7 +1443,7 @@ def RelativeError(res, ex):
1443
1443
n = DotExact (list (x ) + [- res ], list (y ) + [1 ])
1444
1444
return fabs (n / target_sumprod )
1445
1445
1446
- def Trial (dotfunc , c = 10e7 , n = 10 ):
1446
+ def Trial (dotfunc , c , n ):
1447
1447
ex = GenDot (10 , c )
1448
1448
res = dotfunc (ex .x , ex .y )
1449
1449
return RelativeError (res , ex )
@@ -1452,7 +1452,7 @@ def Trial(dotfunc, c=10e7, n=10):
1452
1452
n = 20 # Length of vectors
1453
1453
c = 1e30 # Target condition number
1454
1454
1455
- relative_err = median (Trial (sumprod , c = c , n = n ) for i in range (times ))
1455
+ relative_err = median (Trial (sumprod , c , n ) for i in range (times ))
1456
1456
self .assertLess (relative_err , 1e-16 )
1457
1457
1458
1458
def testModf (self ):
0 commit comments