Commit graph

704 commits

Author SHA1 Message Date
Damien George
2b4292abcc
Make optimize's bisect,fmin,newton use C stack instead of heap (#536)
Signed-off-by: Damien George <damien.p.george@gmail.com>
2022-07-11 19:18:40 +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
Damien George
1898c2fc71
Fix error message for maximum number of dimensions (#532)
Signed-off-by: Damien George <damien.p.george@gmail.com>
2022-07-06 05:55:46 +02:00
Philip Howard
00139bdd96
Drop third argument from MP_REGISTER_MODULE. (#529)
Adopt pattern from efe23aca71/docs/develop/cmodules.rst

Signed-off-by: Phil Howard <phil@pimoroni.com>
2022-06-16 14:26:10 +02:00
Zoltán Vörös
d438344943
fix in-place assignment from slices (#524)
* fix in-place assignment from slices
2022-05-17 21:25: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
d2939dbf22 fix binary ops on empty arrays 2022-02-18 19:34:30 +01:00
Zoltán Vörös
607fd303bb remove printf 2022-02-12 18:40:44 +01:00
Zoltán Vörös
0ef2341386 fix complex slicing 2022-02-10 19:57:19 +01: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
effbd3cf38 add ULAB_HASH 2022-02-03 21:23:11 +01:00
Zoltán Vörös
ae9604db21
Merge branch 'master' into spectrogram 2022-02-01 20:29:53 +01:00
Zoltán Vörös
6dcad4424c extend loadtxt documentation 2022-02-01 18:42:58 +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
9d79960ef6 fix docs glitch, bump version number to 5.0.0 2022-01-29 21:53:42 +01:00
Zoltán Vörös
67538b0ee0 move spectrogram to utils module 2022-01-29 18:02:48 +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
26d28166f8
Merge branch 'master' into sosfilt-fix 2022-01-21 17:29:28 +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
640a3bf777 do not include sosfilt, if ULAB_MAX_DIMS = 1 2022-01-19 17:49:01 +01:00
Zoltán Vörös
6092d1d406 trying to solve macintosh compilation error 2022-01-19 17:46:41 +01:00
Zoltán Vörös
3f97d7bb84 fix scipy.signal.sosfilt 2022-01-19 17:37:54 +01:00
Zoltán Vörös
209e7ff251 add savetxt implementation 2022-01-18 21:20:57 +01:00
Zoltán Vörös
4739e06473 fix ndarray_copy_view for Boolean dtypes 2022-01-18 16:42:03 +01:00