Commit graph

40 commits

Author SHA1 Message Date
Zoltán Vörös
dfed7a844a
implement nonzero (#540)
* implement nonzero for Boolean arrays

* remove axtls from build script

* extend nonzero to ndarrays of arbitrary dtype, and iterable, fix float tests

* temporarily disable circuitpython tests

* add nonzero documentation

* Added test script for np.nonzero()

Co-authored-by: Tejal Ashwini Barnwal <64950661+tejalbarnwal@users.noreply.github.com>
2022-08-03 20:56:45 +02:00
Damien George
35b58d0037 Remove MICROPY_FLOAT_CONST from ULAB_DEFINE_FLOAT_CONST
A given use of ULAB_DEFINE_FLOAT_CONST may already have the correct form
of the float constant, so wrapping it in MICROPY_FLOAT_CONST may be the
wrong thing to do.  So let the user of ULAB_DEFINE_FLOAT_CONST control how
the constant is formed.

Signed-off-by: Damien George <damien.p.george@gmail.com>
2022-07-11 15:27:49 +10:00
346c936e14
Fix E, PI constants on REPR_A
REPR_A is used for e.g., broadcom build raspberrypi_pi4b.

This is a trick, so that the appended 'f' is attached to the "0.".

Without this, a diagnostic occurred:
```
../../extmod/ulab/code/numpy/../ndarray.h:27:34: error: invalid suffix "FF" on floating constant
```
2022-07-07 17:15:09 -05:00
fc6e200afe
Fix INF, NAN constants on REPR_A
REPR_A is used for e.g., broadcom build raspberrypi_pi4b.

This is a trick, so that the appended 'f' is attached to the "0.".
Infinity plus zero is still zero, and nan plus zero is still zero.

Without this, a diagnostic occurred:
```
../../extmod/ulab/code/numpy/numpy.c:64:60: error: pasting ")" and "F" does not give a valid preprocessing token
```
2022-07-07 17:14:35 -05:00
308627c9aa
Fix several build errors in CircuitPython (#533)
* Properly register submodules of ulab

This is related to
 * https://github.com/adafruit/circuitpython/issues/6066

in which, after the merge of 1.18 into CircuitPython, we lost the ability
to import submodules of built-in modules.

While reconstructing the changes we had made locally to enable this,
I discovered that there was an easier way: simply register the dotted
module names via MP_REGISTER_MODULE.

* Fix finding processor count when no `python` executable is installed

debian likes to install only `python3`, and not `python` (which was,
for many decades, python2).

This was previously done for `build.sh` but not for `build-cp.sh`.

* Only use this submodule feature in CircuitPython

.. as it does not work properly in MicroPython.

Also, modules to be const. This saves a small amount of RAM

* Fix -Werror=undef diagnostic

Most CircuitPython ports build with -Werror=undef, so that use of an
undefined preprocessor flag is an error. Also, CircuitPython's micropython
version is old enough that MICROPY_VERSION is not (ever) defined.

Defensively check for this macro being defined, and use the older style
of MP_REGISTER_MODULE when it is not.

* Fix -Werror=discarded-qualifiers diagnostics

Most CircuitPython ports build with -Werror=discarded-qualifiers.
This detected a problem where string constants were passed to functions
with non-constant parameter types.

* bump version number

* Use MicroPython-compatible registration of submodules

* straggler

* Remove spurious casts

these were build errors for micropython

* Run tests for both nanbox and regular variant during CI
2022-07-07 20:17:49 +02:00
Damien George
1347694672
Fix build for MICROPY_OBJ_REPR_D configurations (#531)
* Fix use of object pointers so code builds with MICROPY_OBJ_REPR_D

Signed-off-by: Damien George <damien.p.george@gmail.com>

* Fix use of float constants so they work with MICROPY_OBJ_REPR_D

Signed-off-by: Damien George <damien.p.george@gmail.com>

* Use new float-const macros to simplify definitions of e,inf,nan,pi.

Signed-off-by: Damien George <damien.p.george@gmail.com>

* Add support for MICROPY_OBJ_REPR_C

Signed-off-by: Damien George <damien.p.george@gmail.com>

* Add unix-nanbox build to build.sh script

Building nanbox requires gcc-multilib because it forces 32-bit mode.

Signed-off-by: Damien George <damien.p.george@gmail.com>

* Bump version to 5.0.8

Signed-off-by: Damien George <damien.p.george@gmail.com>
2022-07-06 20:38:20 +02:00
Zoltán Vörös
5395c76d98 first implementation of loadtxt 2022-01-25 23:00:08 +01:00
Zoltán Vörös
209e7ff251 add savetxt implementation 2022-01-18 21:20:57 +01:00
Zoltán Vörös
a1f1cd255b rebasing from master 2022-01-15 09:54:15 +01:00
Zoltán Vörös
d8ce4b395f rebase from master 2022-01-15 09:46:13 +01:00
Zoltán Vörös
74533d18ff add asarray, and tests for asarray and size 2022-01-14 20:45:14 +01:00
Zoltán Vörös
63ab589b8c add numpy.size 2022-01-14 19:57:18 +01:00
Zoltán Vörös
e5020f8d57 add numpy.delete 2022-01-10 22:54:09 +01:00
Zoltán Vörös
6a7d20dd58 add real/imag properties to ndarray 2022-01-02 19:14:12 +01:00
Zoltán Vörös
d39549e3ac add sort_complex function 2022-01-02 17:34:38 +01:00
Zoltán Vörös
cb3f4b3898 add compress function 2022-01-02 12:46:12 +01:00
Zoltán Vörös
4855baa8cc add conjugate function 2022-01-01 00:33:28 +01:00
Zoltán Vörös
4d7e279996 fix circuitpython documentation 2021-12-30 08:54:52 +01:00
Zoltán Vörös
3557e16cd1 implement sqrt for complex arrays 2021-12-07 19:55:15 +01:00
Zoltán Vörös
911fdb4587 ulab can now be compiled with complex support 2021-12-03 08:59:23 +01:00
Zoltán Vörös
3817d7698a fix compilation for 1D 2021-07-23 07:28:17 +02:00
Jeff Epler
7032a92339 Fix documentation build
* Move most documentation out of the ulab base module.
 * float -> _float
 * ulab.ndarray -> ulab.numpy.ndarray

This still does not build unless it is taken together with a modification
to CircuitPython that _also_ moves references to ulab.numpy.
Because of this, this PR will continue to show red.  The suitability of
the changes can be gaged by looking at the related CircuitPython PR build
or by running locally the build-cp.sh script with the right ref checked
out in circuitpython/
2021-07-20 17:26:43 -05:00
Zoltán Vörös
96550c8ed4 re-arrange files, so that circuitpython docs can be generated 2021-07-14 23:15:19 +02:00
Zoltán Vörös
4b2ab160b6 add empty, update docs 2021-06-03 11:39:26 +02:00
Tsutomu IKEGAMI
93cb294765 Fix implementation of math constants (e, inf, nan, pi).
Originally, math constants are implemented for MICROPY_OBJ_REPR = A and B.
Modify float object representations to work with MICROPY_OBJ_REPR = C and D.
2021-04-23 15:54:16 +09:00
ef65415b55 CircuitPython make check-stubs fixes 2021-04-03 12:10:08 -05:00
fe6677335f code: Add a docstring for numpy, scipy packages
.. this fixes a problem in CircuitPython where building the docs would say
"../shared-bindings/ulab/numpy/approx/index.rst: WARNING: document isn't included in any toctree"
2021-04-03 12:05:42 -05:00
Zoltán Vörös
6668bb3060 add where implementation 2021-03-23 17:09:27 +01:00
Zoltán Vörös
317943b970 moved trace to numpy 2021-02-13 09:25:08 +01:00
Zoltán Vörös
701ad767c8 moved the dot function to numpy 2021-02-13 09:06:02 +01:00
Zoltán Vörös
e485b0c5e4 implemented any/all for iterables and scalars 2021-02-01 21:05:43 +01:00
Zoltán Vörös
c622fe61d8 added isinf/isfinite functions 2021-01-29 22:38:40 +01:00
Zoltán Vörös
b26c3754c5 pulled in workflow files from master 2021-01-15 16:20:35 +01:00
Zoltán Vörös
06bb8348a0 updated docs, removed circuitpython stuff, and fixed diff code 2021-01-14 19:40:18 +01:00
Zoltán Vörös
9f9e006955
Merge pull request #280 from CallumJHays/numpy-scipy
Rename array to ndarray, replaced with constructor fn.
Should address the comment in https://github.com/v923z/micropython-ulab/issues/275.
2021-01-09 08:55:36 +01:00
CallumJHays
9dfc972180 Rename array to ndarray, replaced with constructor fn 2021-01-09 11:43:55 +10:00
Zoltán Vörös
b8ab59bd84 re-organised code, extended docs 2021-01-08 17:40:44 +01:00
Zoltán Vörös
941d36f635 moved frombuffer to ulab_create 2020-11-26 18:53:29 +01:00
Zoltán Vörös
42f20bcc67 added the frombuffer function 2020-11-26 17:26:15 +01:00
Zoltán Vörös
815b543c81 moved numpy.c/numpy.h into its own folder 2020-11-26 07:00:23 +01:00
Renamed from code/numpy.c (Browse further)