Skip to content

Commit

Permalink
doctests: allow rounding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Jul 30, 2016
1 parent d606d14 commit dfd1751
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions pyunlocbox/functions.py
Expand Up @@ -489,8 +489,8 @@ class norm_nuclear(norm):
--------
>>> import pyunlocbox
>>> f = pyunlocbox.functions.norm_nuclear()
>>> f.eval([[1, 2],[2, 3]])
4.4721359549995787
>>> f.eval([[1, 2],[2, 3]]) # doctest:+ELLIPSIS
4.47213595...
>>> f.prox([[1, 2],[2, 3]], 1)
array([[ 0.89442719, 1.4472136 ],
[ 1.4472136 , 2.34164079]])
Expand Down Expand Up @@ -537,9 +537,9 @@ class norm_tv(norm):
>>> f = pyunlocbox.functions.norm_tv()
>>> x = np.arange(0, 16)
>>> x = x.reshape(4, 4)
>>> f.eval(x)
>>> f.eval(x) # doctest:+ELLIPSIS
norm_tv evaluation : 5.210795e+01
52.107950630558953
52.10795063...
"""

Expand Down
10 changes: 5 additions & 5 deletions pyunlocbox/solvers.py
Expand Up @@ -138,8 +138,8 @@ def solve(functions, x0, solver=None, atol=None, dtol=None, rtol=1e-3,
Verify the stopping criterion (should be smaller than atol=1e-2):
>>> np.linalg.norm(ret['sol'] - y)**2
0.008780587752251795
>>> np.linalg.norm(ret['sol'] - y)**2 # doctest:+ELLIPSIS
0.00878058...
Show the solution (should be close to y w.r.t. the L2-norm measure):
Expand All @@ -159,9 +159,9 @@ def solve(functions, x0, solver=None, atol=None, dtol=None, rtol=1e-3,
4
>>> ret['time'] # doctest:+SKIP
0.0012578964233398438
>>> ret['objective'] # doctest:+NORMALIZE_WHITESPACE
[[126.0, 0], [13.999999999999998, 0], [1.5555555555555558, 0],
[0.032930436204105726, 0], [0.0087805877522517933, 0]]
>>> ret['objective'] # doctest:+NORMALIZE_WHITESPACE,+ELLIPSIS
[[126.0, 0], [13.99999999..., 0], [1.55555555..., 0],
[0.03293043..., 0], [0.00878058..., 0]]
"""

Expand Down

0 comments on commit dfd1751

Please sign in to comment.