Compare commits
2 commits
master
...
sort_compl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c758859640 | ||
|
|
cf38fcd424 |
5 changed files with 21 additions and 3 deletions
|
|
@ -191,8 +191,12 @@ mp_obj_t carray_sort_complex(mp_obj_t _source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ndarray_obj_t *ndarray = ndarray_copy_view_convert_type(source, NDARRAY_COMPLEX);
|
ndarray_obj_t *ndarray = ndarray_copy_view_convert_type(source, NDARRAY_COMPLEX);
|
||||||
mp_float_t *array = (mp_float_t *)ndarray->array;
|
|
||||||
carray_sort_complex_(array, ndarray->len);
|
if(ndarray->len != 0) {
|
||||||
|
mp_float_t *array = (mp_float_t *)ndarray->array;
|
||||||
|
carray_sort_complex_(array, ndarray->len);
|
||||||
|
}
|
||||||
|
|
||||||
return MP_OBJ_FROM_PTR(ndarray);
|
return MP_OBJ_FROM_PTR(ndarray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
#include "user/user.h"
|
#include "user/user.h"
|
||||||
#include "utils/utils.h"
|
#include "utils/utils.h"
|
||||||
|
|
||||||
#define ULAB_VERSION 6.0.6
|
#define ULAB_VERSION 6.0.7
|
||||||
#define xstr(s) str(s)
|
#define xstr(s) str(s)
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@ version 6.0.6
|
||||||
|
|
||||||
Sun, 21 Jan 2023
|
Sun, 21 Jan 2023
|
||||||
|
|
||||||
|
version 6.0.7
|
||||||
|
|
||||||
|
treat empty arrays in sort_complex correctly
|
||||||
|
|
||||||
|
Sun, 21 Jan 2023
|
||||||
|
|
||||||
version 6.0.5
|
version 6.0.5
|
||||||
|
|
||||||
fix ones()/zeros() method when the amount of memory to allocate overflows
|
fix ones()/zeros() method when the amount of memory to allocate overflows
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float, np.complex)
|
||||||
|
|
||||||
for dtype in dtypes:
|
for dtype in dtypes:
|
||||||
print(np.sort_complex(np.array(range(5, 0, -1), dtype=dtype)))
|
print(np.sort_complex(np.array(range(5, 0, -1), dtype=dtype)))
|
||||||
|
# these should all return an empty complex array
|
||||||
|
print(np.sort_complex(np.array(range(5, 0, 1), dtype=dtype)))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
n = 6
|
n = 6
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j, 4.0+0.0j, 5.0+0.0j], dtype=complex)
|
||||||
|
array([], dtype=complex)
|
||||||
|
|
||||||
array([1.0+1.0j, 1.0+2.0j, 1.0+3.0j, 1.0+4.0j, 1.0+5.0j, 1.0+6.0j], dtype=complex)
|
array([1.0+1.0j, 1.0+2.0j, 1.0+3.0j, 1.0+4.0j, 1.0+5.0j, 1.0+6.0j], dtype=complex)
|
||||||
array([1.0+0.0j, 1.0+1.0j, 1.0+2.0j, 1.0+3.0j, 1.0+4.0j, 1.0+5.0j], dtype=complex)
|
array([1.0+0.0j, 1.0+1.0j, 1.0+2.0j, 1.0+3.0j, 1.0+4.0j, 1.0+5.0j], dtype=complex)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue