aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/extmod/ulab/tests/1d
diff options
context:
space:
mode:
Diffstat (limited to 'circuitpython/extmod/ulab/tests/1d')
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py17
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py.exp42
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py18
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py.exp42
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/imag_real.py19
-rw-r--r--circuitpython/extmod/ulab/tests/1d/complex/imag_real.py.exp14
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py3
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py.exp1
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py62
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py.exp22
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/compare.py13
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/compare.py.exp5
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/convolve.py15
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/convolve.py.exp1
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/fft.py37
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/fft.py.exp2
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/gc.py11
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/gc.py.exp4
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/interp.py12
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/interp.py.exp4
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/optimize.py28
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/optimize.py.exp5
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/poly.py51
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/poly.py.exp24
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/slicing.py23
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/slicing.py.exp996
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py8
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py.exp2
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/sum.py21
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/sum.py.exp6
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/trapz.py9
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/trapz.py.exp2
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py141
-rw-r--r--circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py.exp32
34 files changed, 1692 insertions, 0 deletions
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py b/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py
new file mode 100644
index 0000000..979b5b8
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py
@@ -0,0 +1,17 @@
+# this test is meaningful only, when the firmware supports complex arrays
+
+try:
+ from ulab import numpy as np
+except:
+ import numpy as np
+
+dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float, np.complex)
+
+for dtype in dtypes:
+ a = np.array(range(4), dtype=dtype)
+ print('\narray:\n', a)
+ print('\nexponential:\n', np.exp(a))
+
+b = np.array([0, 1j, 2+2j, 3-3j], dtype=np.complex)
+print('\narray:\n', b)
+print('\nexponential:\n', np.exp(b)) \ No newline at end of file
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py.exp b/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py.exp
new file mode 100644
index 0000000..fb34d53
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/complex_exp.py.exp
@@ -0,0 +1,42 @@
+
+array:
+ array([0, 1, 2, 3], dtype=uint8)
+
+exponential:
+ array([1.0, 2.718281828459045, 7.38905609893065, 20.08553692318767], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=int8)
+
+exponential:
+ array([1.0, 2.718281828459045, 7.38905609893065, 20.08553692318767], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=uint16)
+
+exponential:
+ array([1.0, 2.718281828459045, 7.38905609893065, 20.08553692318767], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=int16)
+
+exponential:
+ array([1.0, 2.718281828459045, 7.38905609893065, 20.08553692318767], dtype=float64)
+
+array:
+ array([0.0, 1.0, 2.0, 3.0], dtype=float64)
+
+exponential:
+ array([1.0, 2.718281828459045, 7.38905609893065, 20.08553692318767], dtype=float64)
+
+array:
+ array([0.0+0.0j, 1.0+0.0j, 2.0+0.0j, 3.0+0.0j], dtype=complex)
+
+exponential:
+ array([1.0+0.0j, 2.718281828459045+0.0j, 7.38905609893065+0.0j, 20.08553692318767+0.0j], dtype=complex)
+
+array:
+ array([0.0+0.0j, 0.0+1.0j, 2.0+2.0j, 3.0-3.0j], dtype=complex)
+
+exponential:
+ array([1.0+0.0j, 0.5403023058681398+0.8414709848078965j, -3.074932320639359+6.71884969742825j, -19.88453084414699-2.834471132487004j], dtype=complex)
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py b/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py
new file mode 100644
index 0000000..aa709ae
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py
@@ -0,0 +1,18 @@
+# this test is meaningful only, when the firmware supports complex arrays
+
+try:
+ from ulab import numpy as np
+except:
+ import numpy as np
+
+dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float, np.complex)
+
+for dtype in dtypes:
+ a = np.array(range(4), dtype=dtype)
+ outtype = np.float if dtype is not np.complex else np.complex
+ print('\narray:\n', a)
+ print('\nsquare root:\n', np.sqrt(a, dtype=outtype))
+
+b = np.array([0, 1j, 2+2j, 3-3j], dtype=np.complex)
+print('\narray:\n', b)
+print('\nsquare root:\n', np.sqrt(b, dtype=np.complex)) \ No newline at end of file
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py.exp b/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py.exp
new file mode 100644
index 0000000..30459fc
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/complex_sqrt.py.exp
@@ -0,0 +1,42 @@
+
+array:
+ array([0, 1, 2, 3], dtype=uint8)
+
+square root:
+ array([0.0, 1.0, 1.414213562373095, 1.732050807568877], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=int8)
+
+square root:
+ array([0.0, 1.0, 1.414213562373095, 1.732050807568877], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=uint16)
+
+square root:
+ array([0.0, 1.0, 1.414213562373095, 1.732050807568877], dtype=float64)
+
+array:
+ array([0, 1, 2, 3], dtype=int16)
+
+square root:
+ array([0.0, 1.0, 1.414213562373095, 1.732050807568877], dtype=float64)
+
+array:
+ array([0.0, 1.0, 2.0, 3.0], dtype=float64)
+
+square root:
+ array([0.0, 1.0, 1.414213562373095, 1.732050807568877], dtype=float64)
+
+array:
+ array([0.0+0.0j, 1.0+0.0j, 2.0+0.0j, 3.0+0.0j], dtype=complex)
+
+square root:
+ array([0.0+0.0j, 1.0+0.0j, 1.414213562373095+0.0j, 1.732050807568877+0.0j], dtype=complex)
+
+array:
+ array([0.0+0.0j, 0.0+1.0j, 2.0+2.0j, 3.0-3.0j], dtype=complex)
+
+square root:
+ array([0.0+0.0j, 0.7071067811865476+0.7071067811865475j, 1.553773974030037+0.6435942529055827j, 1.902976705995016-0.7882387605032136j], dtype=complex)
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py b/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py
new file mode 100644
index 0000000..e05783b
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py
@@ -0,0 +1,19 @@
+# this test is meaningful only, when the firmware supports complex arrays
+
+try:
+ from ulab import numpy as np
+except:
+ import numpy as np
+
+dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float, np.complex)
+
+for dtype in dtypes:
+ a = np.array(range(5), dtype=dtype)
+ print('real part: ', np.real(a))
+ print('imaginary part: ', np.imag(a))
+
+
+b = np.array([0, 1j, 2+2j, 3-3j], dtype=np.complex)
+print('real part: ', np.real(b))
+print('imaginary part: ', np.imag(b))
+
diff --git a/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py.exp b/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py.exp
new file mode 100644
index 0000000..977fb4a
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/complex/imag_real.py.exp
@@ -0,0 +1,14 @@
+real part: array([0, 1, 2, 3, 4], dtype=uint8)
+imaginary part: array([0, 0, 0, 0, 0], dtype=uint8)
+real part: array([0, 1, 2, 3, 4], dtype=int8)
+imaginary part: array([0, 0, 0, 0, 0], dtype=int8)
+real part: array([0, 1, 2, 3, 4], dtype=uint16)
+imaginary part: array([0, 0, 0, 0, 0], dtype=uint16)
+real part: array([0, 1, 2, 3, 4], dtype=int16)
+imaginary part: array([0, 0, 0, 0, 0], dtype=int16)
+real part: array([0.0, 1.0, 2.0, 3.0, 4.0], dtype=float64)
+imaginary part: array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=float64)
+real part: array([0.0, 1.0, 2.0, 3.0, 4.0], dtype=float64)
+imaginary part: array([0.0, 0.0, 0.0, 0.0, 0.0], dtype=float64)
+real part: array([0.0, 0.0, 2.0, 3.0], dtype=float64)
+imaginary part: array([0.0, 1.0, 2.0, -3.0], dtype=float64)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py b/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py
new file mode 100644
index 0000000..c756273
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py
@@ -0,0 +1,3 @@
+from ulab import numpy as np
+
+print(np.ones(3))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py.exp
new file mode 100644
index 0000000..f4cff3b
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/00smoke.py.exp
@@ -0,0 +1 @@
+array([1.0, 1.0, 1.0], dtype=float64)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py b/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py
new file mode 100644
index 0000000..e2aa0bc
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py
@@ -0,0 +1,62 @@
+from ulab import numpy as np
+
+# Adapted from https://docs.python.org/3.8/library/itertools.html#itertools.permutations
+def permutations(iterable, r=None):
+ # permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC
+ # permutations(range(3)) --> 012 021 102 120 201 210
+ pool = tuple(iterable)
+ n = len(pool)
+ r = n if r is None else r
+ if r > n:
+ return
+ indices = list(range(n))
+ cycles = list(range(n, n-r, -1))
+ yield tuple(pool[i] for i in indices[:r])
+ while n:
+ for i in reversed(range(r)):
+ cycles[i] -= 1
+ if cycles[i] == 0:
+ indices[i:] = indices[i+1:] + indices[i:i+1]
+ cycles[i] = n - i
+ else:
+ j = cycles[i]
+ indices[i], indices[-j] = indices[-j], indices[i]
+ yield tuple(pool[i] for i in indices[:r])
+ break
+ else:
+ return
+
+# Combinations expected to throw
+try:
+ print(np.argmin([]))
+except ValueError:
+ print("ValueError")
+
+try:
+ print(np.argmax([]))
+except ValueError:
+ print("ValueError")
+
+# Combinations expected to succeed
+print(np.argmin([1]))
+print(np.argmax([1]))
+print(np.argmin(np.array([1])))
+print(np.argmax(np.array([1])))
+
+print()
+print("max tests")
+for p in permutations((100,200,300)):
+ m1 = np.argmax(p)
+ m2 = np.argmax(np.array(p))
+ print(p, m1, m2)
+ if m1 != m2 or p[m1] != max(p):
+ print("FAIL", p, m1, m2, max(p))
+
+print()
+print("min tests")
+for p in permutations((100,200,300)):
+ m1 = np.argmin(p)
+ m2 = np.argmin(np.array(p))
+ print(p, m1, m2)
+ if m1 != m2 or p[m1] != min(p):
+ print("FAIL", p, m1, m2, min(p))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py.exp
new file mode 100644
index 0000000..d77e4c7
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/argminmax.py.exp
@@ -0,0 +1,22 @@
+ValueError
+ValueError
+0
+0
+0
+0
+
+max tests
+(100, 200, 300) 2 2
+(100, 300, 200) 1 1
+(200, 100, 300) 2 2
+(200, 300, 100) 1 1
+(300, 100, 200) 0 0
+(300, 200, 100) 0 0
+
+min tests
+(100, 200, 300) 0 0
+(100, 300, 200) 0 0
+(200, 100, 300) 1 1
+(200, 300, 100) 2 2
+(300, 100, 200) 1 1
+(300, 200, 100) 2 2
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))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/compare.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/compare.py.exp
new file mode 100644
index 0000000..b9024e4
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/compare.py.exp
@@ -0,0 +1,5 @@
+array([1.0, 2.0, 3.0, 2.0, 1.0], dtype=float64)
+array([5.0, 4.0, 3.0, 4.0, 5.0], dtype=float64)
+5.5
+array([3, 3, 3, 3, 4, 5, 6, 7, 7], dtype=uint8)
+array([3.0, 3.0, 3.0, 3.0, 4.0, 5.0, 6.0, 7.0, 7.0], dtype=float64)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py b/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py
new file mode 100644
index 0000000..93aa23f
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py
@@ -0,0 +1,15 @@
+import math
+
+try:
+ from ulab import numpy as np
+except ImportError:
+ import numpy as np
+
+x = np.array((1,2,3))
+y = np.array((1,10,100,1000))
+result = (np.convolve(x, y))
+ref_result = np.array([1, 12, 123, 1230, 2300, 3000],dtype=np.float)
+cmp_result = []
+for p,q in zip(list(result), list(ref_result)):
+ cmp_result.append(math.isclose(p, q, rel_tol=1e-06, abs_tol=1e-06))
+print(cmp_result)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py.exp
new file mode 100644
index 0000000..63a3ac6
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/convolve.py.exp
@@ -0,0 +1 @@
+[True, True, True, True, True, True]
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/fft.py b/circuitpython/extmod/ulab/tests/1d/numpy/fft.py
new file mode 100644
index 0000000..1a1dee7
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/fft.py
@@ -0,0 +1,37 @@
+import math
+try:
+ from ulab import numpy as np
+ use_ulab = True
+except ImportError:
+ import numpy as np
+ use_ulab = False
+
+x = np.linspace(-np.pi, np.pi, num=8)
+y = np.sin(x)
+
+if use_ulab:
+ a, b = np.fft.fft(y)
+ c, d = np.fft.ifft(a, b)
+ # c should be equal to y
+ cmp_result = []
+ for p,q in zip(list(y), list(c)):
+ cmp_result.append(math.isclose(p, q, rel_tol=1e-09, abs_tol=1e-09))
+ print(cmp_result)
+
+ z = np.zeros(len(x))
+ a, b = np.fft.fft(y, z)
+ c, d = np.fft.ifft(a, b)
+ # c should be equal to y
+ cmp_result = []
+ for p,q in zip(list(y), list(c)):
+ cmp_result.append(math.isclose(p, q, rel_tol=1e-09, abs_tol=1e-09))
+ print(cmp_result)
+
+else:
+ a = np.fft.fft(y)
+ c = np.fft.ifft(a)
+ # c should be equal to y
+ cmp_result = []
+ for p,q in zip(list(y), list(c.real)):
+ cmp_result.append(math.isclose(p, q, rel_tol=1e-09, abs_tol=1e-09))
+ print(cmp_result)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/fft.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/fft.py.exp
new file mode 100644
index 0000000..c9b2279
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/fft.py.exp
@@ -0,0 +1,2 @@
+[True, True, True, True, True, True, True, True]
+[True, True, True, True, True, True, True, True]
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/gc.py b/circuitpython/extmod/ulab/tests/1d/numpy/gc.py
new file mode 100644
index 0000000..4dbf079
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/gc.py
@@ -0,0 +1,11 @@
+from ulab import numpy as np
+import gc
+
+data = np.ones(1000)[6:-6]
+print(sum(data))
+print(data)
+
+gc.collect()
+
+print(sum(data))
+print(data) \ No newline at end of file
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/gc.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/gc.py.exp
new file mode 100644
index 0000000..f14e5c8
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/gc.py.exp
@@ -0,0 +1,4 @@
+988.0000000000001
+array([1.0, 1.0, 1.0, ..., 1.0, 1.0, 1.0], dtype=float64)
+988.0000000000001
+array([1.0, 1.0, 1.0, ..., 1.0, 1.0, 1.0], dtype=float64)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/interp.py b/circuitpython/extmod/ulab/tests/1d/numpy/interp.py
new file mode 100644
index 0000000..09d3dc3
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/interp.py
@@ -0,0 +1,12 @@
+try:
+ from ulab import numpy as np
+except ImportError:
+ import numpy as np
+
+x = np.array([1, 2, 3, 4, 5])
+xp = np.array([1, 2, 3, 4])
+fp = np.array([1, 2, 3, 4])
+print(np.interp(x, xp, fp))
+print(np.interp(x, xp, fp, left=0.0))
+print(np.interp(x, xp, fp, right=10.0))
+print(np.interp(x, xp, fp, left=0.0, right=10.0))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/interp.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/interp.py.exp
new file mode 100644
index 0000000..717a890
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/interp.py.exp
@@ -0,0 +1,4 @@
+array([1.0, 2.0, 3.0, 4.0, 4.0], dtype=float64)
+array([1.0, 2.0, 3.0, 4.0, 4.0], dtype=float64)
+array([1.0, 2.0, 3.0, 4.0, 10.0], dtype=float64)
+array([1.0, 2.0, 3.0, 4.0, 10.0], dtype=float64)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py b/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py
new file mode 100644
index 0000000..fce8672
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py
@@ -0,0 +1,28 @@
+import math
+
+try:
+ from ulab import scipy as spy
+except ImportError:
+ import scipy as spy
+
+def f(x):
+ return x**2 - 2.0
+
+ref_result = 1.4142135623715149
+result = (spy.optimize.bisect(f, 1.0, 3.0))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+ref_result = -7.105427357601002e-15
+result = spy.optimize.fmin(f, 3.0, fatol=1e-15)
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+ref_result = -7.105427357601002e-15
+result = spy.optimize.fmin(f, 3.0, xatol=1e-8, fatol=1e-15, maxiter=500)
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+ref_result = 1.41421826342255
+result = (spy.optimize.newton(f, 3.0, tol=0.001, rtol=0.01))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (spy.optimize.newton(f, 3.0, tol=0.001, rtol=0.01, maxiter=100))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py.exp
new file mode 100644
index 0000000..2e883c5
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/optimize.py.exp
@@ -0,0 +1,5 @@
+True
+True
+True
+True
+True
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/poly.py b/circuitpython/extmod/ulab/tests/1d/numpy/poly.py
new file mode 100644
index 0000000..02ce7f5
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/poly.py
@@ -0,0 +1,51 @@
+import math
+
+try:
+ from ulab import numpy as np
+except ImportError:
+ import numpy as np
+
+p = [1, 1, 1, 0]
+x = [0, 1, 2, 3, 4]
+result = np.polyval(p, x)
+ref_result = np.array([0, 3, 14, 39, 84])
+for i in range(len(x)):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+
+a = np.array(x)
+result = np.polyval(p, a)
+ref_result = np.array([0, 3, 14, 39, 84])
+for i in range(len(x)):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+
+# linear fit
+x = np.linspace(-10, 10, 20)
+y = 1.5*x + 3
+result = np.polyfit(x, y, 1)
+ref_result = np.array([ 1.5, 3.0])
+for i in range(2):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+
+# 2nd degree fit
+x = np.linspace(-10, 10, 20)
+y = x*x*2.5 - x*0.5 + 1.2
+result = np.polyfit(x, y, 2)
+ref_result = np.array([2.5, -0.5, 1.2])
+for i in range(3):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+
+# 3rd degree fit
+x = np.linspace(-10, 10, 20)
+y = x*x*x*1.255 + x*x*1.0 - x*0.75 + 0.0
+result = np.polyfit(x, y, 3)
+ref_result = np.array([1.255, 1.0, -0.75, 0.0])
+for i in range(4):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+
+# 4th degree fit
+x = np.linspace(-10, 10, 20)
+y = x*x*x*x + x*x*x*1.255 + x*x*1.0 - x*0.75 + 0.0
+result = np.polyfit(x, y, 4)
+ref_result = np.array([1.0, 1.255, 1.0, -0.75, 0.0])
+for i in range(5):
+ print(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/poly.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/poly.py.exp
new file mode 100644
index 0000000..9d0c61b
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/poly.py.exp
@@ -0,0 +1,24 @@
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py b/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py
new file mode 100644
index 0000000..466c3b2
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py
@@ -0,0 +1,23 @@
+try:
+ from ulab import numpy as np
+except:
+ import numpy as np
+
+for num in range(1,4):
+ for start in range(-num, num+1):
+ for end in range(-num, num+1):
+ for stride in (-3, -2, -1, 1, 2, 3):
+ l = list(range(num))
+ a = np.array(l, dtype=np.int8)
+ sl = l[start:end:stride]
+ ll = len(sl)
+ try:
+ sa = list(a[start:end:stride])
+ except IndexError as e:
+ sa = str(e)
+ print("%2d [% d:% d:% d] %-24r %-24r%s" % (
+ num, start, end, stride, sl, sa, " ***" if sa != sl else ""))
+
+ a[start:end:stride] = np.ones(len(sl)) * -1
+ print("%2d [% d:% d:% d] %r" % (
+ num, start, end, stride, list(a)))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py.exp
new file mode 100644
index 0000000..9d7d892
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/slicing.py.exp
@@ -0,0 +1,996 @@
+ 1 [-1:-1:-3] [] []
+ 1 [-1:-1:-3] [0]
+ 1 [-1:-1:-2] [] []
+ 1 [-1:-1:-2] [0]
+ 1 [-1:-1:-1] [] []
+ 1 [-1:-1:-1] [0]
+ 1 [-1:-1: 1] [] []
+ 1 [-1:-1: 1] [0]
+ 1 [-1:-1: 2] [] []
+ 1 [-1:-1: 2] [0]
+ 1 [-1:-1: 3] [] []
+ 1 [-1:-1: 3] [0]
+ 1 [-1: 0:-3] [] []
+ 1 [-1: 0:-3] [0]
+ 1 [-1: 0:-2] [] []
+ 1 [-1: 0:-2] [0]
+ 1 [-1: 0:-1] [] []
+ 1 [-1: 0:-1] [0]
+ 1 [-1: 0: 1] [] []
+ 1 [-1: 0: 1] [0]
+ 1 [-1: 0: 2] [] []
+ 1 [-1: 0: 2] [0]
+ 1 [-1: 0: 3] [] []
+ 1 [-1: 0: 3] [0]
+ 1 [-1: 1:-3] [] []
+ 1 [-1: 1:-3] [0]
+ 1 [-1: 1:-2] [] []
+ 1 [-1: 1:-2] [0]
+ 1 [-1: 1:-1] [] []
+ 1 [-1: 1:-1] [0]
+ 1 [-1: 1: 1] [0] [0]
+ 1 [-1: 1: 1] [-1]
+ 1 [-1: 1: 2] [0] [0]
+ 1 [-1: 1: 2] [-1]
+ 1 [-1: 1: 3] [0] [0]
+ 1 [-1: 1: 3] [-1]
+ 1 [ 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 2]
+ 3 [ 3: 3: 1] [] []
+ 3 [ 3: 3: 1] [0, 1, 2]
+ 3 [ 3: 3: 2] [] []
+ 3 [ 3: 3: 2] [0, 1, 2]
+ 3 [ 3: 3: 3] [] []
+ 3 [ 3: 3: 3] [0, 1, 2]
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py b/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py
new file mode 100644
index 0000000..05b2d79
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py
@@ -0,0 +1,8 @@
+try:
+ from ulab import numpy as np
+except:
+ import numpy as np
+
+a = np.array(range(9), dtype=np.float)
+print("a:\t", list(a))
+print("a < 5:\t", list(a[a < 5]))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py.exp
new file mode 100644
index 0000000..2c94646
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/slicing2.py.exp
@@ -0,0 +1,2 @@
+a: [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
+a < 5: [0.0, 1.0, 2.0, 3.0, 4.0]
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/sum.py b/circuitpython/extmod/ulab/tests/1d/numpy/sum.py
new file mode 100644
index 0000000..a029313
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/sum.py
@@ -0,0 +1,21 @@
+from ulab import numpy as np
+
+r = range(15)
+
+a = np.array(r, dtype=np.uint8)
+print(np.sum(a))
+
+a = np.array(r, dtype=np.int8)
+print(np.sum(a))
+
+a = np.array(r, dtype=np.uint16)
+print(np.sum(a))
+
+a = np.array(r, dtype=np.int16)
+print(np.sum(a))
+
+a = np.array(r, dtype=np.float)
+print(np.sum(a))
+
+a = np.array([False] + [True]*15, dtype=np.bool)
+print(np.sum(a))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/sum.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/sum.py.exp
new file mode 100644
index 0000000..7f1b801
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/sum.py.exp
@@ -0,0 +1,6 @@
+105
+105
+105
+105
+105.0
+15
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py b/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py
new file mode 100644
index 0000000..7060c12
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py
@@ -0,0 +1,9 @@
+try:
+ from ulab import numpy as np
+except ImportError:
+ import numpy as np
+
+x = np.linspace(0, 9, num=10)
+y = x*x
+print(np.trapz(y))
+print(np.trapz(y, x=x))
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py.exp
new file mode 100644
index 0000000..3084186
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/trapz.py.exp
@@ -0,0 +1,2 @@
+244.5
+244.5
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py b/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py
new file mode 100644
index 0000000..1dc3b60
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py
@@ -0,0 +1,141 @@
+import math
+
+try:
+ from ulab import numpy as np
+ from ulab import scipy as spy
+except ImportError:
+ import numpy as np
+ import scipy as spy
+
+result = (np.sin(np.pi/2))
+ref_result = 1.0
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.cos(np.pi/2))
+ref_result = 0.0
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.tan(np.pi/2))
+ref_result = 1.633123935319537e+16
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.sinh(np.pi/2))
+ref_result = 2.3012989023072947
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.cosh(np.pi/2))
+ref_result = 2.5091784786580567
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.tanh(np.pi/2))
+ref_result = 0.9171523356672744
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+ref_result = np.pi/2
+result = (np.asin(np.sin(np.pi/2)))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.acos(np.cos(np.pi/2)))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.atan(np.tan(np.pi/2)))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.cosh(np.acosh(np.pi/2)))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+result = (np.sinh(np.asinh(np.pi/2)))
+print(math.isclose(result, ref_result, rel_tol=1E-6, abs_tol=1E-6))
+
+print(np.degrees(np.pi))
+print(np.radians(np.degrees(np.pi)))
+print(np.floor(np.pi))
+print(np.ceil(np.pi))
+print(np.sqrt(np.pi))
+print(np.exp(1))
+print(np.log(np.exp(1)))
+
+print(np.log2(2**1))
+
+print(np.log10(10**1))
+print(np.exp(1) - np.expm1(1))
+
+x = np.array([-1, +1, +1, -1])
+y = np.array([-1, -1, +1, +1])
+result = (np.arctan2(y, x) * 180 / np.pi)
+ref_result = np.array([-135.0, -45.0, 45.0, 135.0], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+x = np.linspace(-2*np.pi, 2*np.pi, 5)
+result = np.sin(x)
+ref_result = np.array([2.4492936e-16, -1.2246468e-16, 0.0000000e+00, 1.2246468e-16, -2.4492936e-16], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = np.cos(x)
+ref_result = np.array([1., -1., 1., -1., 1.], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = np.tan(x)
+ref_result = np.array([2.4492936e-16, 1.2246468e-16, 0.0000000e+00, -1.2246468e-16, -2.4492936e-16], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = np.sinh(x)
+ref_result = np.array([-267.74489404, -11.54873936, 0., 11.54873936, 267.74489404], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = np.cosh(x)
+ref_result = np.array([267.74676148, 11.59195328, 1.0, 11.59195328, 267.74676148], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = np.tanh(x)
+ref_result = np.array([-0.9999930253396107, -0.99627207622075, 0.0, 0.99627207622075, 0.9999930253396107], dtype=np.float)
+cmp_result = []
+for i in range(len(x)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = (spy.special.erf(np.linspace(-3, 3, num=5)))
+ref_result = np.array([-0.9999779095030014, -0.9661051464753108, 0.0, 0.9661051464753108, 0.9999779095030014], dtype=np.float)
+cmp_result = []
+for i in range(len(ref_result)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = (spy.special.erfc(np.linspace(-3, 3, num=5)))
+ref_result = np.array([1.99997791e+00, 1.96610515e+00, 1.00000000e+00, 3.38948535e-02, 2.20904970e-05], dtype=np.float)
+cmp_result = []
+for i in range(len(ref_result)):
+ cmp_result.append(math.isclose(result[i], ref_result[i], rel_tol=1E-6, abs_tol=1E-6))
+print(cmp_result)
+
+result = (spy.special.gamma(np.array([0, 0.5, 1, 5])))
+ref_result = np.array([1.77245385, 1.0, 24.0])
+cmp_result = []
+cmp_result.append(math.isinf(result[0]))
+for i in range(len(ref_result)):
+ cmp_result.append(math.isclose(result[i+1], ref_result[i], rel_tol=1E-9, abs_tol=1E-9))
+print(cmp_result)
+
+result = (spy.special.gammaln([0, -1, -2, -3, -4]))
+cmp_result = []
+for i in range(len(ref_result)):
+ cmp_result.append(math.isinf(result[i]))
+print(cmp_result)
diff --git a/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py.exp b/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py.exp
new file mode 100644
index 0000000..2931d6c
--- /dev/null
+++ b/circuitpython/extmod/ulab/tests/1d/numpy/universal_functions.py.exp
@@ -0,0 +1,32 @@
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+180.0
+3.141592653589793
+3.0
+4.0
+1.772453850905516
+2.718281828459045
+1.0
+1.0
+1.0
+1.0
+[True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True, True]
+[True, True, True, True]
+[True, True, True]