53c158bde3
ndarray.c: circuitpython needs translate() for mp_raise
2020-03-30 15:34:01 -05:00
Zoltán Vörös
b3562ae78c
Boolean indexing raises TypeError, if index is not of Boolean type
2020-03-30 12:58:04 +02:00
Zoltán Vörös
ea4a7422ef
fixing Boolean indexing issue
2020-03-30 12:45:54 +02:00
3dc52575f0
slice_length: avoid implementation-defined division by negative number
...
In CircuitPython (only), a the slice assignment to [-1👎 -3] of an
ndarray of length 1 caused a crash. This appears to be because in
CircuitPython, the internal pointer of an empty array was NULL rather than
pointing at some memory which happened to be valid and assignable.
This appears to be a corner case of how integer promotion rules work in C.
The expression `slice.stop - slice.start + (slice.step + correction)`
is type `unsigned long` and on a LP64 platform its value is
18446744073709551614. This led to the function returning that this slice
had length 1 instead, during the automated tests.
By casting to signed types capable of holding indices and sizes, the
problem is corrected on both platforms.
2020-03-16 22:09:39 -05:00
Zoltán Vörös
3e53136a93
ndarrays can now be initialised from ndarrays
2020-03-12 07:17:54 +01:00
Jeff Epler
f9fabc5079
Fix handling of negative indices
...
I don't know why, but mp_seq_get_fast_slice_indexes adjusts "stop" in a
surprising way, and that led to the (remaining) differences in slicing
between ulab and built-in lists.
// If the index is negative then stop points to the last item, not after it
if (indexes->step < 0) {
indexes->stop++;
}
Call the underlying routine, mp_obj_slice_indices, instead.
2020-02-29 17:00:42 -06:00
Jeff Epler
585513ce76
Return empty slices as empty ndarrays, not exceptions
...
This matches the behavior of built-in lists as well as numpy
2020-02-29 16:57:59 -06:00
Zoltán Vörös
6fe015f134
properties are now defined in ndarray_properties.h
2020-02-16 19:49:01 +01:00
Zoltán Vörös
d8bfe46bd8
added __name__ to all submodules
2020-02-14 19:51:28 +01:00
Jeff Epler
fc80a25685
Increase CircuitPython compatibility
...
- Adapt to signature of mp_make_new_fun_t for mpy and cpy by ifdef
- Use MP_OBJ_IS_TYPE instead of mp_obj_is_type
- Ditto MP_OBJ_IS_INT
- Use mp_const_none instead of MP_ROM_NONE
- Ditto mp_const_true, mp_const_false
2020-02-12 10:15:47 -06:00
Zoltán Vörös
2c71467ced
implemented ndarray properties
2020-02-11 20:08:37 +01:00
Zoltán Vörös
89170a13a6
fixed error in filter.c, removed asbytearray, and added buffer protocol to ndarray.c
2020-02-10 19:50:49 +01:00
Zoltán Vörös
936bb3bae5
corrected slicing error in issue #32
2020-02-09 19:56:32 +01:00
Zoltán Vörös
76ccd1a118
the master branch is configurable now
2020-02-07 21:23:24 +01:00
Zoltán Vörös
b2c4749962
replaced MP_ROM_PTR macro, wherever it made sense
2020-01-20 19:55:38 +01:00
Zoltán Vörös
68e38bc6b8
backup commit
2020-01-06 07:43:27 +01:00
Nicko van Someren
e33720e9c0
Fixed several issues preventing compilation on macOS
2019-11-11 13:39:28 -08:00
Zoltán Vörös
08b8fd0ae2
fixed float_t->mp_float_t mistake in ndarray.c
2019-11-04 19:28:06 +01:00
Zoltán Vörös
6e4911d96f
replaced float with mp_float_t everywhere, so that the source can be compiled for all platforms
2019-11-01 14:28:29 +01:00
Zoltán Vörös
761ad69d71
fully implemented subscription methods
2019-10-29 21:12:12 +01:00
Zoltán Vörös
5599dd2f31
fixed small bug in rawsize
2019-10-19 19:45:26 +02:00
Zoltán Vörös
d4acce7b1f
extended documentation, and moved size function to linalg
2019-10-16 20:08:16 +02:00
Zoltán Vörös
5caa711422
extended manual, inserted links to numpy functions
2019-10-12 22:33:13 +02:00
Zoltán Vörös
e30b8d6f4e
added first version of manual, fixed small bug in roll
2019-10-11 21:45:14 +02:00
Zoltán Vörös
be6ab7ba18
extended universal functions for arbitrary typecode
2019-10-11 18:59:45 +02:00
Zoltán Vörös
0c161e2ba3
fixed error in iterator and make_new
2019-10-11 15:58:17 +02:00
Zoltán Vörös
68dd3a7423
this is mainly a safety backup; subscr is not fully implemented yet
2019-10-10 22:01:26 +02:00
Zoltán Vörös
1c233de552
extended unary operators in ndarray.c
2019-10-08 17:37:53 +02:00
Zoltán Vörös
4a8ecc28f2
added keyword arguments to linspace, made binary_op tighter
2019-10-07 20:49:29 +02:00
Zoltán Vörös
ba975c100d
added comparison operators to ndarray
2019-10-05 15:59:03 +02:00
Zoltán Vörös
7feaf8c57e
removed printf statement in ndarray.c
2019-10-04 20:11:28 +02:00
Zoltán Vörös
cadae1dbf7
extended linalg, added .flatten to ndarray
2019-10-04 20:06:04 +02:00
Zoltán Vörös
52694959d3
bit of clean-up in binary_op/removed upcasting()
2019-10-04 12:32:49 +02:00
Zoltán Vörös
6a65d33445
fixed half of the binary operator code (implemented macros)
2019-09-27 20:23:25 +02:00
Zoltán Vörös
093bc39b7d
cleaned up material for first release
2019-09-25 17:33:02 +02:00
Zoltán Vörös
be8be6d155
fixed subscription method
2019-09-17 22:23:07 +02:00
Zoltán Vörös
69037a2d60
added in-place fft implementation
2019-09-17 21:25:27 +02:00
Zoltán Vörös
d9f9a26197
implemented binary operators
2019-09-11 19:51:48 +02:00
Zoltán Vörös
5997dd2a5c
implemented numpy-like iterators
2019-09-06 20:24:18 +02:00
Zoltán Vörös
f7884529fe
added keyword argument to ndarray
2019-09-05 21:56:00 +02:00
Zoltán Vörös
3ed5e1a651
initial commit
2019-08-31 18:51:26 +02:00