c66509f66e
add test of boolean slicing
2020-03-30 15:34:26 -05:00
53c158bde3
ndarray.c: circuitpython needs translate() for mp_raise
2020-03-30 15:34:01 -05:00
cbe41034a3
ndarray.h: provide mp_obj_is_bool for circuitpython
2020-03-30 15:33:45 -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
Zoltán Vörös
a91b36986d
Merge pull request #65 from jepler/slice-length-crash
...
slice_length: avoid implementation-defined division by negative number
2020-03-17 08:15:48 +01: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
155e6eea60
Merge pull request #63 from v923z/round
...
added around and arctan2 to the vector sub-module, and extended ndarray initialisation options
2020-03-16 22:19:05 +01:00
Zoltán Vörös
94e5b304d2
added arctan2 to vectorise.c
2020-03-16 19:36:37 +01:00
Zoltán Vörös
49e2e68f9b
added around to vectorise.c, and implemented array initialiation from another ndarray
2020-03-12 17:28:23 +01:00
Zoltán Vörös
3e53136a93
ndarrays can now be initialised from ndarrays
2020-03-12 07:17:54 +01:00
Zoltán Vörös
7ec399c58b
Merge pull request #62 from v923z/cholesky-test
...
added tests for linalg, and poly
2020-03-11 21:38:35 +01:00
Zoltán Vörös
47fd7964e8
generated .exp test files
2020-03-11 21:31:36 +01:00
Zoltán Vörös
e3a74453a8
trying to fix test routines
2020-03-11 18:53:06 +01:00
Zoltán Vörös
18d13e4252
added tests for inv, and det
2020-03-11 17:15:30 +01:00
Zoltán Vörös
cb1b1d352b
added test files for the poly sub-module
2020-03-11 07:31:00 +01:00
Zoltán Vörös
c354657eda
added test files for the Cholesky decomposition
2020-03-11 07:04:26 +01:00
Zoltán Vörös
037cd6e733
re-named spectrum->spectrogram, updated manual
2020-03-10 21:11:44 +01:00
Jeff Epler
1095994a4a
Merge pull request #59 from v923z/cholesky
...
added Cholesky decomposition to linalg.c, updated documentation
2020-03-10 14:51:48 -05:00
Jeff Epler
ea2bf3c236
Merge pull request #57 from v923z/spectrum
...
moved spectrum to extras module
2020-03-10 14:51:37 -05:00
Zoltán Vörös
525fbb6527
added Cholesky decomposition to linalg.c, updated documentation
2020-03-10 20:40:11 +01:00
Zoltán Vörös
5d0eab244b
added function declarations to linalg.h
2020-03-09 21:22:31 +01:00
Zoltán Vörös
6b3d43846f
moved spectrum to extras module
2020-03-09 20:47:58 +01:00
Jeff Epler
8241546378
Merge pull request #56 from v923z/workflow
...
include only code changes in workflow file
2020-03-07 20:31:00 -06:00
Zoltán Vörös
0434045293
Update README.md
...
Clarified statement on CP builds.
2020-03-07 09:46:50 +01:00
Zoltán Vörös
34c2355a2a
tried to fix workflow file
2020-03-07 09:36:10 +01:00
Zoltán Vörös
0faa89e3a5
tried to fix workflow file
2020-03-07 09:33:48 +01:00
Zoltán Vörös
c0979509b4
run CI only for changes in code/, and tests/
2020-03-07 09:31:30 +01:00
Zoltán Vörös
ef2c91c1fb
Merge pull request #55 from v923z/readme
...
updated readme
2020-03-06 21:18:54 +01:00
Zoltán Vörös
fb1153d3b3
updated readme
2020-03-06 21:15:49 +01:00
Zoltán Vörös
847c7f9d63
Merge pull request #54 from v923z/readme
...
updated readme
2020-03-06 18:31:04 +01:00
Zoltán Vörös
ab8b5fe4b1
updated readme
2020-03-06 18:27:59 +01:00
Zoltán Vörös
700e3ff1ac
Merge pull request #53 from v923z/jepler-patch-1
...
Update README.md with circuitpython mentions
2020-03-05 19:24:42 +01:00
Jeff Epler
a35c4ff1d8
Update README.md with circuitpython mentions
2020-03-05 07:22:22 -06:00
Zoltán Vörös
a6ebfc1ade
Merge pull request #52 from codemee/master
...
Deleting "#define MODULE_ULAB_ENABLED (1)"
2020-03-02 07:57:33 +01:00
codemee
882294dabf
Deleting "#define MODULE_ULAB_ENABLED (1)"
...
Since the micropython.mk file has added the following line
```
CFLAGS_EXTRA = -DMODULE_ULAB_ENABLED=1
```
There's no need to add #define MODULE_ULAB_ENABLED (1) in the mpconfigport.h.Or it would make redefined errors while compiling code.
2020-03-02 12:26:19 +08:00
Zoltán Vörös
adda973b56
Merge pull request #50 from jepler/slicing-fixes
...
Slicing fixes
2020-03-01 18:47:59 +01:00
Jeff Epler
903016ec44
slicing: add test of slice assignment
...
This tests that ulab and python3/numpy match on various slice assignments
that preserve the length of the array. slice assignments that change
the length of the array are not tested.
Unlike the case of "load slice", this case of "modify slice" is not
compared to the built in list type, since "modify slice" is only
implemented in micropython for simple (stride=1) slices.
2020-02-29 17:11:56 -06:00
Jeff Epler
380b8b0347
Add new test of slicing
...
Closes : #32
2020-02-29 17:00:53 -06: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
Jeff Epler
2ea9656d3f
build: include debug information (may also disable optimization)
...
.. this makes it much more pleasant to trace down problems using gdb.
2020-02-29 16:57:09 -06:00
Jeff Epler
66b89de8c7
Always include creation functions
2020-02-27 14:07:04 -06:00
Jeff Epler
844b85018b
Merge pull request #49 from jepler/gitignore
...
ignore files created by ./build.sh
2020-02-27 13:58:25 -06:00
Jeff Epler
1c1a693a2b
Merge pull request #48 from v923z/create
...
created new create sub-module for ndarray initialisation functions
2020-02-27 13:58:14 -06:00
Jeff Epler
f81e950513
ignore files created by ./build.sh
2020-02-27 13:56:09 -06:00
Jeff Epler
ffff7606c8
fix tests after 'eye' was moved
2020-02-27 13:53:29 -06:00
Zoltán Vörös
bee25781b9
added new source file...
2020-02-27 20:46:52 +01:00
Zoltán Vörös
47bf2ec9a7
created new create sub-module for ndarray initialisation functions
2020-02-27 20:39:13 +01:00
Jeff Epler
badeee48df
Merge pull request #47 from jepler/local-build-script
...
a script to build and run tests locally
2020-02-27 10:12:03 -06:00