Commit graph

228 commits

Author SHA1 Message Date
Philip Howard
63dfbd178b
Remove the STATIC macro. (#664)
Reflect the changes proposed in micropython/micropython#13763.
2024-02-29 21:34:50 +01:00
Zoltán Vörös
acfec3e9af
fix reshape (#660) 2024-02-10 20:46:34 +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
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
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
Zoltán Vörös
3e996d9bd9
fix ndarray subscription method (#619) 2023-05-17 20:45:07 +02: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
Zoltán Vörös
47ad73ab57
Floordiv (#593)
* implement floor division

* fix 3D, 4D loops

* add missing array declaration in 3D, and 4D

* Add test cases for floor division and fix it for ints (#599)

* Add test cases for floor division

* Fix define name in comment

* Fix floor division of ints

---------

Co-authored-by: Maciej Sokołowski <matemaciek@gmail.com>
2023-04-23 21:14:59 +02:00
315c988393
Check that array size doesn't overflow at construction time
Now, requesting to allocate an array that is too big gives the exception
'array is too big', like numpy.

This does depend on a gcc extension, `__builtin_mul_overflow`, present
since at least version 5. This extension is also supported in clang.
msvc is probably the only compiler of note that does not support it.

Closes: #576
2023-01-19 07:15:58 -06: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
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
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
e8c89935ab fix array dtype conversion, linalg float constants 2022-01-30 19:55:59 +01:00
Zoltán Vörös
4739e06473 fix ndarray_copy_view for Boolean dtypes 2022-01-18 16:42:03 +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
97b368412c fix complex printout for long arrays 2022-01-10 23:23:09 +01:00
Zoltán Vörös
969afdec7f implement ==, and != for complex dtypes 2022-01-07 14:05:38 +01:00
Zoltán Vörös
ad9e1e9950 fix linspace error, extend to complex dtype, factor out tests 2022-01-06 19:55:34 +01:00
Zoltán Vörös
2b578ae333 add tolist method to ndarray 2022-01-01 18:16:04 +01:00
Zoltán Vörös
c11dac322d fix array initialisation from complex array 2022-01-01 09:20:00 +01:00
Zoltán Vörös
7e13fab911 support ones, zeros, and full for complex dtype 2021-12-31 23:39:58 +01:00
Zoltán Vörös
dbd570a9fb implement complex scalar binary operations 2021-12-28 22:18:37 +01:00
Zoltán Vörös
235329c3fb fix itemsize glitch 2021-12-03 09:11:41 +01:00
Zoltán Vörös
ce26a0d76b implement slicing for complex dtype 2021-12-03 09:06:49 +01:00
Zoltán Vörös
78455afa5d simplify binary_get_size function 2021-12-03 09:06:49 +01:00
Zoltán Vörös
93409e759a implement iterator for complex arrays 2021-12-03 09:06:49 +01:00
Zoltán Vörös
3b3639a560 implement complex exponential 2021-12-03 09:06:49 +01:00
Zoltán Vörös
316f84174d rebasing with any/all fix 2021-12-03 09:04:04 +01:00
Zoltán Vörös
ef8989ecff implement unary operators for complex arrays 2021-12-03 08:59:23 +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
175c7337bb fix ndarray_shape for arrays of zero length 2021-11-20 12:11:21 +01:00
Jeff Epler
d68171bb46
Merge pull request #439 from jepler/circuitpython-make-new-compat
ndarray: drop compat workaround for circuitpython
2021-10-16 16:02:16 -05:00
b913d064e5 ndarray: drop compat workaround for circuitpython
It's anticipated that circuitpython will no longer need this compat code
after merging 1.17.
2021-10-14 14:26:38 -05:00
5ff8bd662f remove temporary workaround 2021-07-23 09:57:17 -05:00
Zoltán Vörös
3817d7698a fix compilation for 1D 2021-07-23 07:28:17 +02:00
Jeff Epler
cbe4c7499b docs: A workaround for the problem where ndarray can't be in two places
This allows the build to be green in ulab before the changes in
circuitpython. After circuitpython's _typing/__init__.py is fixed to
use the new canonical location, this temporary alias can be removed.
2021-07-22 08:15:23 -05: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
6ed12969d3 implement flat iterator 2021-07-13 21:35:01 +02:00
Zoltán Vörös
7f38ad9315 implement ndarray.shape assigment 2021-06-19 15:58:56 +02:00
Zoltán Vörös
cd3d479b30 remove redudant cases from ndarray_set_value 2021-06-10 19:01:31 +02:00