MCPcopy Create free account
hub / github.com/numpy/numpy / check

Function check

numpy/core/tests/test_mem_overlap.py:398–412  ·  view source on GitHub ↗
(A, U, exists=None)

Source from the content-addressed store, hash-verified

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

Calls 5

assert_Function · 0.90
solve_diophantineFunction · 0.85
sumFunction · 0.50
allFunction · 0.50
anyFunction · 0.50

Tested by

no test coverage detected