Commit graph

152 commits

Author SHA1 Message Date
Zoltán Vörös
57de23c1fb
fix how arctan2 treats scalars (#546) 2022-08-04 07:35:20 +02:00
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
53bc8d6b0e
replace m_new with m_new0, wherever reasonable (#521)
replace m_new with m_new0, wherever reasonable, and remove dangling memory fragments created by m_new0
2022-04-22 22:10:01 +02:00
Alec Delaney
a715eed7d9 Fix reference 2022-04-22 12:10:42 -04:00
Alec Delaney
8da81e123e
Fix typo of name from spectrum to spectrogram 2022-04-22 11:30:49 -04:00
Alec Delaney
8c2cd49ffa
Fix reference to location of spectrum() 2022-04-20 18:08:57 -04:00
Alec Delaney
2772fd8e91
Update reference to spectrum 2022-04-19 21:45:34 -04:00
Zoltán Vörös
dde8d24461 add sort tests 2022-04-18 10:34:02 +02:00
Zoltán Vörös
48b3b7f641 fix sorting on empty arrays 2022-04-18 10:18:19 +02:00
Zoltán Vörös
72f7df520a fix diag for the ndim = 2 case 2022-02-09 07:06:54 +01:00
Zoltán Vörös
4dc9afc1f8 fix np.diag 2022-02-08 17:37:00 +01:00
Zoltán Vörös
9ba136acd4 fix savetxt comments default value 2022-01-31 22:28:50 +01:00
Zoltán Vörös
f5f42c3643 add skiprows keyword 2022-01-31 22:12:00 +01:00
Zoltán Vörös
65d6f8e947 fix buffer alignment error 2022-01-30 22:47:44 +01:00
Zoltán Vörös
e8c89935ab fix array dtype conversion, linalg float constants 2022-01-30 19:55:59 +01:00
Zoltán Vörös
e980564d64 assign array elements via function 2022-01-29 22:41:03 +01:00
Zoltán Vörös
19282b47d1 add dtype keyword to loadtxt 2022-01-29 22:30:11 +01:00
Zoltán Vörös
089000df30
Merge branch 'master' into io-savetxt 2022-01-28 19:28:43 +01:00
Zoltán Vörös
bb07482efc implement max_roas keyword 2022-01-27 23:44:29 +01:00
Zoltán Vörös
f31555044a implement loadtxt keywords 2022-01-26 22:31:36 +01:00
Zoltán Vörös
f7b557c6b0 get rid of unnecessary counter in loadtxt 2022-01-26 08:09:05 +01:00
Zoltán Vörös
9f444dd718 use mp_builtin_open_obj.fun.kw instead of mp_builtin_open 2022-01-26 07:43:17 +01:00
Zoltán Vörös
a39869c43c remove redundant includes 2022-01-25 23:09:10 +01:00
Zoltán Vörös
5395c76d98 first implementation of loadtxt 2022-01-25 23:00:08 +01:00
Zoltán Vörös
77a856e84e fix compilation problem on the rp2 port 2022-01-25 18:10:06 +01:00
Zoltán Vörös
d56dd2f921 add io_sprint for systems that don't have sprintf 2022-01-24 20:37:33 +01:00
Zoltán Vörös
957ae1c50a fix macintosh compilation 2022-01-19 20:04:41 +01:00
Zoltán Vörös
73fcd895db
Merge branch 'master' into io 2022-01-19 19:56:44 +01:00
Zoltán Vörös
932060afcc fully implement savetxt 2022-01-19 19:52:50 +01:00
Zoltán Vörös
209e7ff251 add savetxt implementation 2022-01-18 21:20:57 +01:00
Zoltán Vörös
bd57ac8938 include uinstd.h header 2022-01-16 16:17:06 +01:00
Zoltán Vörös
024b3ea6e8 change npy, fin, fout to stream, stream_p for consistency 2022-01-15 09:54:23 +01:00
Zoltán Vörös
97d2c2c3c5 always close file before exception, change exception type 2022-01-15 09:54:23 +01:00
Zoltán Vörös
b9d46c7f92 try to fix uninitialised variable issue 2022-01-15 09:54:23 +01:00
Zoltán Vörös
a1f1cd255b rebasing from master 2022-01-15 09:54:15 +01:00
Zoltán Vörös
834ddc8218 attempt to fix eps32 compilation error 2022-01-15 09:46:24 +01:00
Zoltán Vörös
4b0c3215fd close file in save implementation 2022-01-15 09:46:24 +01:00
Zoltán Vörös
acb81aeded fix loop index in numpy.save 2022-01-15 09:46:24 +01:00
Zoltán Vörös
56b3d800e3 add input type checking 2022-01-15 09:46:24 +01:00
Zoltán Vörös
030463f7ff include stdio.h for mac 2022-01-15 09:46:24 +01:00
Zoltán Vörös
d8ce4b395f rebase from master 2022-01-15 09:46:13 +01:00
Zoltán Vörös
32ebcb4c06 fix size argument handling 2022-01-14 22:54:04 +01:00
Zoltán Vörös
b12f3d0b4d fix asarray initialiser 2022-01-14 22:25:17 +01:00
Zoltán Vörös
1fc2f18358 fix size return value 2022-01-14 20:49:42 +01:00
Zoltán Vörös
74533d18ff add asarray, and tests for asarray and size 2022-01-14 20:45:14 +01:00