(A, U, exists=None)
| 397 | |
| 398 | def test_internal_overlap_diophantine(): |
| 399 | def check(A, U, exists=None): |
| 400 | X = solve_diophantine(A, U, 0, require_ub_nontrivial=1) |
| 401 | |
| 402 | if exists is None: |
| 403 | exists = (X is not None) |
| 404 | |
| 405 | if X is not None: |
| 406 | sum_ax = sum(a * x for a, x in zip(A, X)) |
| 407 | sum_au_half = sum(a * u // 2 for a, u in zip(A, U)) |
| 408 | assert_(sum_ax == sum_au_half) |
| 409 | assert_(all(0 <= x <= u for x, u in zip(X, U))) |
| 410 | assert_(any(x != u // 2 for x, u in zip(X, U))) |
| 411 | |
| 412 | if exists: |
| 413 | assert_(X is not None, repr(X)) |
| 414 | else: |
| 415 | assert_(X is None, repr(X)) |
| 416 | |
| 417 | # Smoke tests |
| 418 | check((3, 2), (2 * 2, 3 * 2), exists=True) |
no test coverage detected
searching dependent graphs…