@@ -14,68 +14,45 @@ The `float` implementation of `micropython` (`float`, or `double`) is automatica
1414` ulab ` implements ` numpy ` 's ` ndarray ` with the ` == ` , ` != ` , ` < ` , ` <= ` , ` > ` , ` >= ` , ` + ` , ` - ` , ` / ` , ` * ` , ` ** ` ,
1515` += ` , ` -= ` , ` *= ` , ` /= ` , ` **= ` binary operators, and the ` len ` , ` ~ ` , ` - ` , ` + ` , ` abs ` unary operators that
1616operate element-wise. Type-aware ` ndarray ` s can be initialised from any ` micropython ` iterable, lists of
17- iterables, or by means of the ` arange ` , ` concatenate ` , ` diag ` , ` eye ` , ` full ` , ` linspace ` , ` logspace ` , ` ones ` , or
17+ iterables, or by means of the ` arange ` , ` concatenate ` , ` diag ` , ` eye ` , ` frombuffer ` , ` full ` , ` linspace ` , ` logspace ` , ` ones ` , or
1818` zeros ` functions.
1919
2020` ndarray ` s can be iterated on, and have a number of their own methods, such as ` flatten ` , ` shape ` ,
2121` reshape ` , ` strides ` , ` transpose ` , ` size ` , ` tobytes ` , and ` itemsize ` .
2222
23- ## Customising the firmware
24-
25- In addition to the ` ndarray ` 's operators and methods, seven modules define a great number of functions that can
26- take ` ndarray ` s or ` micropython ` iterables as their arguments. If flash space is a concern, unnecessary sub-modules
27- or even individual functions can be excluded from the compiled firmware with pre-processor switches.
28-
29- ### approx
30-
31- The ` approx ` sub-module contains the implementation of the ` interp ` , and ` trapz ` functions of ` numpy ` , and ` newton ` , ` bisect ` ,
32- and ` fmin ` from ` scipy ` .
33-
34- ### compare
35-
36- The ` compare ` sub-module contains the implementation of the ` equal ` , ` not_equal ` , ` minimum ` , ` maximum ` , and ` clip ` functions.
37-
38- ### fft
39-
40- The ` fft ` sub-module implements the fast Fourier transform, and its inverse for one-dimensional ` ndarray ` s,
41- as well as the ` spectrogram ` function from ` scipy ` .
4223
43- ### filter
44-
45- The ` filter ` sub-module implements ` convolve ` for one-dimensional convolution,
46- as well as the cascaded second-order sections filter, ` sosfilt ` from ` scipy ` .
47-
48- ### linalg
49-
50- The ` linalg ` sub-module implements functions for matrix inversion, dot product, and the calculation of the
51- determinant, eigenvalues, eigenvectors, Cholesky decomposition, and trace.
52-
53- ### numerical
54-
55- The ` numerical ` sub-module defines the ` cross ` , ` diff ` , ` flip ` , ` median ` , ` roll ` , ` sort ` and ` argsort ` functions for ` ndarray ` s, and,
56- in addition, the ` min ` , ` max ` , ` argmin ` , ` argmax ` , ` sum ` , ` mean ` , ` std ` functions that work with ` ndarray ` s, as
57- well as generic one-dimensional iterables.
24+ ## Customising the firmware
5825
59- ### poly
26+ In addition to the ` ndarray ` operators and methods, ` ulab ` defines a great number of functions that can
27+ take ` ndarray ` s or ` micropython ` iterables as their arguments. If flash space is a concern, unnecessary functions
28+ can be excluded from the compiled firmware with pre-processor switches. Most of the functions are parts of
29+ ` numpy ` , but several are re-implementations of ` scipy ` features. For a full list of functions, see
30+ [ micropython-ulab] ( https://micropython-ulab.readthedocs.io/en/latest ) !
6031
61- The ` poly ` sub-module defines the ` polyval ` , and ` polyfit ` functions from ` numpy ` .
6232
63- ### vector
33+ ## Usage
6434
65- The ` vector ` sub-module implements all functions of ` micropython ` 's ` math ` package (e.g., ` acos ` , ` acosh ` , ..., ` tan ` , ` tanh ` ),
66- and the ` degrees ` and ` radians ` for ` ndarray ` s and iterables. In addition, it also provided tools for vectorising generic,
67- user-defined ` python ` functions.
35+ ` ulab ` sports a ` numpy ` -compatible interface, which makes porting of ` CPython ` code straightforward. The following
36+ snippet should run equally well in ` micropython ` , or on a PC.
6837
69- ### user
38+ ``` python
39+ try :
40+ from ulab import numpy as np
41+ from ulab import scipy as spy
42+ except ImportError :
43+ import numpy as np
44+ import scipy as spy
7045
71- The ` user ` sub-module is meant as a user-extendable module, and contains a dummy function only.
46+ x = np.array([1 , 2 , 3 ])
47+ spy.special.erf(x)
48+ ```
7249
7350# Finding help
7451
7552Documentation can be found on [ readthedocs] ( https://readthedocs.org/ ) under
7653[ micropython-ulab] ( https://micropython-ulab.readthedocs.io/en/latest ) ,
7754as well as at [ circuitpython-ulab] ( https://circuitpython.readthedocs.io/en/latest/shared-bindings/ulab/__init__.html ) .
78- A number of practical examples are listed in the excellent
55+ A number of practical examples are listed in Jeff Epler's excellent
7956[ circuitpython-ulab] ( https://learn.adafruit.com/ulab-crunch-numbers-fast-with-circuitpython/overview ) overview.
8057
8158# Benchmarks
0 commit comments