circuitpython-ulab/tests/numpy/compare.py
Jeff Epler 196104084b tests: try to fit mp, cp, and py3 into one mold
Mostly by providing a "numpy shim" for CircuitPython,
try to make the numpy tests run on all three systems.
(a "scipy shim" might also be useful?)

However, there are test failures.  Is it worth working
through them and getting this to a point where it could
be included?
2020-11-23 15:17:00 -06:00

16 lines
354 B
Python

try:
import numpy as np
except:
import ulab as np
a = np.array([1, 2, 3, 4, 5], dtype=np.uint8)
b = np.array([5, 4, 3, 2, 1], dtype=np.float)
print(np.minimum(a, b))
print(np.maximum(a, b))
print(np.maximum(1, 5.5))
a = np.array(range(9), dtype=np.uint8)
print(np.clip(a, 3, 7))
b = 3 * np.ones(len(a), dtype=np.float)
print(np.clip(a, b, 7))