1
1
# ulab
2
2
3
- ` ulab ` is a ` numpy ` -like array manipulation library for ` micropython ` and ` CircuitPython ` .
3
+ ` ulab ` is a ` numpy ` -like array manipulation library for [ micropython] ( http://micropython.org/ ) and [ CircuitPython] ( https://circuitpython.org/ ) .
4
4
The module is written in C, defines compact containers for numerical data of one to four
5
5
dimensions, and is fast. The library is a software-only standard ` micropython ` user module,
6
6
i.e., it has no hardware dependencies, and can be compiled for any platform.
@@ -14,25 +14,30 @@ The `float` implementation of `micropython` (`float`, or `double`) is automatica
14
14
` ulab ` implements ` numpy ` 's ` ndarray ` with the ` == ` , ` != ` , ` < ` , ` <= ` , ` > ` , ` >= ` , ` + ` , ` - ` , ` / ` , ` * ` , ` ** ` ,
15
15
` += ` , ` -= ` , ` *= ` , ` /= ` , ` **= ` binary operators, and the ` len ` , ` ~ ` , ` - ` , ` + ` , ` abs ` unary operators that
16
16
operate 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 ` , ` frombuffer ` , ` full ` , ` linspace ` , ` logspace ` , ` ones ` , or
18
- ` zeros ` functions.
17
+ iterables via the ` array ` constructor , or by means of the ` arange ` , ` concatenate ` , ` diag ` , ` eye ` ,
18
+ ` frombuffer ` , ` full ` , ` linspace ` , ` logspace ` , ` ones ` , or ` zeros ` functions.
19
19
20
- ` ndarray ` s can be iterated on, and have a number of their own methods, such as ` flatten ` , ` shape ` ,
21
- ` reshape ` , ` strides ` , ` transpose ` , ` size ` , ` tobytes ` , and ` itemsize ` .
20
+ ` ndarray ` s can be iterated on, and have a number of their own methods, such as ` flatten ` , ` itemsize ` , ` reshape ` ,
21
+ ` shape ` , ` size ` , ` strides ` , ` tobytes ` , and ` transpose ` .
22
22
23
23
24
24
## Customising the firmware
25
25
26
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
27
+ take ` ndarray ` s or ` micropython ` iterables as their arguments. Most of the functions have been ported from
28
+ ` numpy ` , but several are re-implementations of ` scipy ` features. For a complete list, see
30
29
[ micropython-ulab] ( https://micropython-ulab.readthedocs.io/en/latest ) !
31
30
31
+ If flash space is a concern, unnecessary functions can be excluded from the compiled firmware with
32
+ pre-processor switches. In addition, ` ulab ` also has options for trading execution speed for firmware size.
33
+ A thorough discussion on how the firmware can be customised can be found in the
34
+ [ corresponding section] ( https://micropython-ulab.readthedocs.io/en/latest/ulab-intro.html#customising-the-firmware )
35
+ of the user manual.
36
+
32
37
33
38
## Usage
34
39
35
- ` ulab ` sports a ` numpy ` -compatible interface, which makes porting of ` CPython ` code straightforward. The following
40
+ ` ulab ` sports a ` numpy/scipy ` -compatible interface, which makes porting of ` CPython ` code straightforward. The following
36
41
snippet should run equally well in ` micropython ` , or on a PC.
37
42
38
43
``` python
0 commit comments