MCPcopy
hub / github.com/numpy/numpy / check

Function check

numpy/_core/tests/test_mem_overlap.py:399–415  ·  view source on GitHub ↗
(A, U, exists=None)

Source from the content-addressed store, hash-verified

397
398def 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)

Calls 4

assert_Function · 0.90
sumFunction · 0.85
allFunction · 0.85
anyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…