Commit graph

1396 commits

Author SHA1 Message Date
Zoltán Vörös
51825edadb ix keepdims for min, max, argmin, argmax 2025-01-26 11:55:51 +01:00
Zoltán Vörös
be15d62632
fix keepdims for std, update docs (#704) 2025-01-19 22:51:02 +01:00
Zoltán Vörös
903506ca9a
Add keepdims keyword argument (#701)
* add function to deal with keepdims=True

* preliminary keepdims fix

* fux keepdims code

* remove out-commented code
2025-01-15 10:29:27 +01:00
Harald Milz
73ed8cc11f
Add scipy integration (#699)
* adding scipy integrate, initial check-in

* compile unix double-precision, select integrations algos

* bumping ulab version number to 6.7.0

* adding documentation

* documentation fix

* documentation fix

* documentation fix

* rewritten in some places

* complex number error handling

* added test cases

* resolved importing scipy.integrate

* resolved importing scipy.integrate #2

* build integrate only when we have MICROPY_FLOAT_IMPL_DOUBLE

* reverting commit a4c0c0b

* re-pushing failed commit

* Revert "re-pushing failed commit"

This reverts commit a10e89fe14.

* improve tests using math.isclose()

* enabled fp32 builds

* removed conditional includes

* adapted to new function names, corrected importing

* function names similar to in CPython scipy.integrate, some minor corrections

* major rewrite representing the name changes, mapping to CPython scipy.integrate, more background info
2024-12-15 18:49:08 +01:00
Zoltán Vörös
303e8d790a
fix compilation error for complexes (#694) 2024-11-24 19:56:15 +01:00
Zoltán Vörös
2b74236c8c
Take (#688)
* add numpy.take
2024-10-09 21:10:25 +02:00
Zoltán Vörös
c0b3262be4
Add keyword arguments to spectrogram (#657)
* re-work spectrogram method, so that RAM can be re-used

* update docs with spectrogram changes
2024-09-14 12:18:14 +02:00
Zoltán Vörös
45f23ebc82
Roll fix (#687)
* fix roll, when shift is 0
2024-09-14 11:38:04 +02:00
Dan Halbert
1d3ddd8f52
numpy/random.c: fix use of MICROPY_PY_RANDOM_SEED_INIT_FUNC (#684) 2024-09-09 06:55:05 +02:00
Pablo Martínez
a77022dcd0
add missing typing (#680) 2024-08-25 16:09:47 +02:00
page200
99cb54a426
Correct a[a < 5] in ulab-ndarray.ipynb (#678) 2024-08-06 11:07:32 +02:00
Zoltán Vörös
41c4363f11
address issue raised in https://github.com/v923z/micropython-ulab/issues/676 (#677)
* ndarrays can be created from buffer
2024-07-23 18:59:29 +02:00
Zoltán Vörös
e40a667e3c
Update README.md 2024-07-23 17:20:56 +02:00
Andy Piper
519c48149f
Removed Pycom reference (#675)
UInfortunately Pycom is no longer a thing, removed from the platforms list.
2024-07-21 13:20:18 +02:00
Philip Howard
6fb60ef9cf
CI: Update some deprecated dependency versions (#669)
* CI: Bump various build workflow versions.

* CI: Continue other jobs on failure.

Give a more complete overview of failures, rather than forcing the developer to play whack-a-mole.

* CI: Do not modify unix mpconfigport.h.

Since `MICROPY_PY_UHASHLIB` does not occur in unix/mpconfigport.h this would have simply
duplicated the config file and supplied it as `MP_CONFIGFILE` triggering a bug in how this
define is handled.
2024-06-06 21:54:24 +02:00
Zoltán Vörös
65c941a805
fix loadtxt for the case, when built-in complexes are not supported (#666) 2024-03-06 18:59:32 +01:00
Philip Howard
63dfbd178b
Remove the STATIC macro. (#664)
Reflect the changes proposed in micropython/micropython#13763.
2024-02-29 21:34:50 +01:00
KB Sriram
c49110572d
Update type annotations in compare.c and vector.c (#663)
- Add type annotations for functions in compare.c
- Update annotations in vector.c to match behavior

Fixes https://github.com/v923z/micropython-ulab/issues/662
2024-02-28 20:27:29 +01:00
Zoltán Vörös
acfec3e9af
fix reshape (#660) 2024-02-10 20:46:34 +01:00
Zoltán Vörös
1c37edbee6
add link to random module documentation in readme (#659) 2024-02-10 18:59:06 +01:00
Zoltán Vörös
9a1d03d90d
Update rp2w.sh 2024-01-16 20:55:21 +01:00
Zoltán Vörös
c3d1cbd7c2
add random documentation rst file (#655) 2024-01-13 18:54:01 +01:00
Zoltán Vörös
f2fad82a97
add random module (#654)
* add random module skeleton

* add Generator object

* add placeholder for random.random method

* add rudimentary random.random implementation

* generator object accept seed(s) argument

* add out keyword

* add support for out keyword argument

* update change log

* add links to header files

* fix file link

* fix error messages

* add uniform to random module

* add normal distribution

* fix argument options in normal and uniform

* update documentation
2024-01-13 18:42:43 +01:00
yyyz
7a9370612f
fix the np.delete bug (#653)
* fix the `np.delete` bug

* fix the `np.delete` bug, add unittest code

* increment the version number and update the change log

* update the expected file `delete.py.exp`
2023-12-25 10:56:16 +01:00
sol
e32920645c
Fix (u)int8 upcasting as per docs and numpy (#650)
* fix wrong #if guard in ndarray_inplace_ams

* implement (u)int8 upcasting rules as per documentation

* bump version
2023-12-11 22:34:21 +01:00
4bde4efa9d
Merge pull request #647 from v923z/circuitpython9
Drop certain CircuitPython workarounds that are no longer needed
2023-10-30 10:41:32 +01:00
eacb0c9af4
fix some more translate()s 2023-10-30 09:54:14 +01:00
8c444ef75d
Merge remote-tracking branch 'origin/master' into circuitpython9 2023-10-30 09:53:55 +01:00
9c9e9532ac
Switch to using MP_ERROR_TEXT in CircuitPython, change ulab accordingly 2023-10-30 09:50:39 +01:00
2df210f87a
Drop certain CircuitPython workarounds that are no longer needed
* ndarray_set_value: in CircuitPython 9
 * mp_obj_slice_indices: ditto
 * Use modern MP_REGISTER_MODULE calls: ditto
 * use MP_OBJ_SENTINEL to forward to locals dict (was never necessary?)
2023-09-22 14:47:02 -05:00
Xuebin Ruan
a05ec05351
Fix #643 (#645)
* Fix #643

* Update to version 6.4.1
2023-08-10 10:25:19 +02:00
Zoltán Vörös
5279de73ab
implement AND, OR, XOR binary operators (#639)
* implement AND, OR, XOR binary operators

* fix unterminated if

* add missing linebreak

* add more linebreaks

* remove leading linebreak
2023-07-21 21:57:31 +02:00
KB Sriram
84f99f17fc
numpy/vector.c: remove usage of fpclassify (#636)
Fixes https://github.com/v923z/micropython-ulab/issues/635

Verified by re-compiling circuitpython with this change.
2023-07-17 22:03:30 +02:00
d025aa3cf6
Per github docs, run apt-get update (#637)
https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners
2023-07-17 10:10:23 +02:00
Zoltán Vörös
d072086c56
allow function iterator in math functions (#633)
* allow function iterator in math functions

* increment version number
2023-07-02 10:02:29 +02:00
38caf84b2d
Fix -Wunused-variable diagnostic when !ULAB_SUPPORTS_COMPLEX (#631)
* Fix -Wunused-variable diagnostic when !ULAB_SUPPORTS_COMPLEX

`o_in` is only used in the SUPPORTS_COMPLEX case, so the variable
definition needs to be moved accordingly.

* update version and changelog
2023-06-28 21:52:04 +02:00
HugoNumworks
112d4f82d3
Polyval handles non-array as second argument (#601)
* Factorize polynomial evaluation

* Polyval handles non-array as second argument

---------

Co-authored-by: Zoltán Vörös <zvoros@gmail.com>
2023-06-27 21:13:53 +02:00
FelixNumworks
319df10cfe
[ndarray] Fix ndarray_from_tuple reading out of _shape->items bounds (#630) 2023-06-26 22:21:50 +02:00
FelixNumworks
26051d70d2
Int overflow (#629)
* Prevent ndarray from overflowing size_t

* Use size_t for polyval array len

* Fix infinite arange

* 6.3.1 version
2023-06-22 14:55:16 +02:00
Derfies
2cde1280a4
Bitwise (#628)
* add bitwise operators

* add build to requirements

* [EDIT] - Tweaked test data and saved test results.

* Tweaked test values for and / or

* [EDIT] - Setting print options to be verbose for test comparisons.

* [EDIT] - Removed call to set_printoptions and added output from ulab instead of numpy. Of note - there seems to be a discrepancy between the numpy and ulab output for one of the left_shift cases.

* [EDIT] - Added newline at end of file for diffing purposes.

* [EDIT] - Added print options back in as output seemed truncated.

---------

Co-authored-by: Zoltán Vörös <zvoros@gmail.com>
Co-authored-by: JamieDouugh <jamie.davies@douugh.com>
2023-06-21 13:46:30 +02:00
Zoltán Vörös
ef248b684d
add bitwise operators (#616)
* add bitwise operators

* add build to requirements
2023-06-20 21:44:58 +02:00
38a4976b58
fix fetching submodules (cp build process change) (#627) 2023-06-20 13:09:01 +02:00
Zoltán Vörös
73dbbf79bb
add the out keyword argument to universal functions (#621)
* add optional out keyword argument to math functions

* fix the keyword handling in sqrt

* run micropython build on ubuntu 20.04 instead of latest

* fix unused variable error in vector_generic_vector
2023-05-28 17:33:24 +02:00
Zoltán Vörös
3e996d9bd9
fix ndarray subscription method (#619) 2023-05-17 20:45:07 +02:00
6619c20b3b
Merge pull request #617 from jepler/sinc-function
ulab.numpy: implement sinc for creating audio filters
2023-05-16 11:47:29 -05:00
f3e6e1c6d2
include new requirement of circuitpython build 2023-05-16 07:33:20 -05:00
6000743c45
fix docstring of sinc 2023-05-16 07:32:25 -05:00
1150554ad5
ulab.numpy: implement sinc for creating audio filters
This is useful for generating FIR filters using code snippets generated at
https://fiiir.com/ (at least those with a rectangular window type; other
window types need additional functions but we can revisit it later if needed)

I think this will come in handy for folks who are using the advanced
features of our audio synthesizer module, synthio.

e.g., the following block now gives highly similar results on ulab
or numpy:

```py
try:
    import numpy as np
except:
    from ulab import numpy as np

# Example code, computes the coefficients of a low-pass windowed-sinc filter.

# Configuration.
fS = 48000  # Sampling rate.
fL = 4000  # Cutoff frequency.
N = 23  # Filter length, must be odd.

# Compute sinc filter.
h = np.sinc(2 * fL / fS * (np.arange(N) - (N - 1) / 2))

# Normalize to get unity gain.
h /= np.sum(h)

# Applying the filter to a signal s can be as simple as writing
# s = np.convolve(s, h)
2023-05-15 18:00:59 -05:00
Zoltán Vörös
ac2e9954ed
ndarray_from_mp_obj correctly treats Booleans (#613) 2023-05-07 12:09:02 +02:00
Zoltán Vörös
beda4c19f8
implement unknown shape dimension in reshape (#612) 2023-05-07 00:21:16 +02:00