diff --git a/.gitignore b/.gitignore index e4b937bb..7d57f782 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /code/.atom-build.yml build/micropython build/ulab +.idea \ No newline at end of file diff --git a/tests/1d/numpy/complex.py b/tests/1d/numpy/complex.py new file mode 100644 index 00000000..67ef7528 --- /dev/null +++ b/tests/1d/numpy/complex.py @@ -0,0 +1,17 @@ +from ulab import numpy as np + +print ( -0.3826834+0.9238795j + 0.5j ) +print ( -0.3826834+0.9238795j + 0.5 ) +print ( -0.3826834+0.9238795j - 0.5 ) +print ( -0.3826834+0.9238795j - 0.5j ) +print ( -0.3826834+0.9238795j * 0.5 ) +print ( -0.3826834+0.9238795j / 0.5 ) + +a = np.array([3.14j], dtype=np.complex) +print(np.exp(a)) + +for n in [0,1j,2,0.3j,4,5j]: + print(n**2) + +x = (-1+1j) +print( np.sqrt(x) ) \ No newline at end of file diff --git a/tests/1d/numpy/complex.py.exp b/tests/1d/numpy/complex.py.exp new file mode 100644 index 00000000..29ee3653 --- /dev/null +++ b/tests/1d/numpy/complex.py.exp @@ -0,0 +1,14 @@ +(-0.3826834+1.4238795j) +(0.1173166+0.9238795j) +(-0.8826834+0.9238795j) +(-0.3826834+0.4238795j) +(-0.3826834+0.46193975j) +(-0.3826834+1.847759j) +array([-0.9999987317275394+0.001592652916486828j], dtype=complex) +0 +(-1+1.224646799147353e-16j) +4 +(-0.08999999999999998+1.102182119232618e-17j) +16 +(-25+3.061616997868382e-15j) +(0.45508986056222733+1.09868411346781j)