From 4fd287655a72b9aea14cdac715ad5b90ed082ed2 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sun, 19 Jun 2022 19:47:51 +0530 Subject: add circuitpython code --- circuitpython/extmod/ulab/tests/1d/numpy/compare.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 circuitpython/extmod/ulab/tests/1d/numpy/compare.py (limited to 'circuitpython/extmod/ulab/tests/1d/numpy/compare.py') diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/compare.py b/circuitpython/extmod/ulab/tests/1d/numpy/compare.py new file mode 100644 index 0000000..cd9fb98 --- /dev/null +++ b/circuitpython/extmod/ulab/tests/1d/numpy/compare.py @@ -0,0 +1,13 @@ +from ulab import numpy 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)) -- cgit v1.2.3