Merge branch 'master' into io

This commit is contained in:
Zoltán Vörös 2022-01-12 21:55:14 +01:00 committed by GitHub
commit b5d94e8fdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 555 additions and 49 deletions

View file

@ -428,7 +428,7 @@ static void ndarray_print_element(const mp_print_t *print, ndarray_obj_t *ndarra
#endif
}
static void ndarray_print_row(const mp_print_t *print, ndarray_obj_t * ndarray, uint8_t *array, size_t stride, size_t n) {
static void ndarray_print_row(const mp_print_t *print, ndarray_obj_t *ndarray, uint8_t *array, int32_t stride, size_t n) {
if(n == 0) {
return;
}
@ -441,7 +441,7 @@ static void ndarray_print_row(const mp_print_t *print, ndarray_obj_t * ndarray,
ndarray_print_element(print, ndarray, array);
}
} else {
mp_obj_print_helper(print, ndarray_get_item(ndarray, array), PRINT_REPR);
ndarray_print_element(print, ndarray, array);
array += stride;
for(size_t i=1; i < ndarray_print_edgeitems; i++, array += stride) {
mp_print_str(print, ", ");

View file

@ -153,6 +153,9 @@ static const mp_rom_map_elem_t ulab_numpy_globals_table[] = {
#if ULAB_NUMPY_HAS_CONCATENATE
{ MP_ROM_QSTR(MP_QSTR_concatenate), (mp_obj_t)&create_concatenate_obj },
#endif
#if ULAB_NUMPY_HAS_DELETE
{ MP_ROM_QSTR(MP_QSTR_delete), (mp_obj_t)&transform_delete_obj },
#endif
#if ULAB_NUMPY_HAS_DIAG
#if ULAB_MAX_DIMS > 1
{ MP_ROM_QSTR(MP_QSTR_diag), (mp_obj_t)&create_diag_obj },

View file

@ -19,6 +19,7 @@
#include "../ulab.h"
#include "../ulab_tools.h"
#include "carray/carray_tools.h"
#include "numerical.h"
#include "transform.h"
#if ULAB_NUMPY_HAS_COMPRESS
@ -33,8 +34,13 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_obj_t condition = args[0].u_obj;
if(!mp_obj_is_type(args[1].u_obj, &ulab_ndarray_type)) {
mp_raise_TypeError(translate("wrong input type"));
}
ndarray_obj_t *ndarray = MP_OBJ_TO_PTR(args[1].u_obj);
uint8_t *array = (uint8_t *)ndarray->array;
mp_obj_t axis = args[2].u_obj;
size_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len_maybe(condition));
@ -62,7 +68,6 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
iterable = mp_getiter(condition, &iter_buf);
ndarray_obj_t *result = NULL;
uint8_t *rarray = NULL;
size_t *shape = m_new(size_t, ULAB_MAX_DIMS);
memcpy(shape, ndarray->shape, ULAB_MAX_DIMS * sizeof(size_t));
@ -77,7 +82,6 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
if(axis == mp_const_none) {
result = ndarray_new_linear_array(true_count, ndarray->dtype);
rarray = (uint8_t *)result->array;
memset(rstrides, 0, ndarray->ndim * sizeof(int32_t));
rstrides[ULAB_MAX_DIMS - 1] = ndarray->itemsize;
rshape[ULAB_MAX_DIMS - 1] = 0;
@ -85,7 +89,6 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
rshape[shift_ax] = true_count;
result = ndarray_new_dense_ndarray(ndarray->ndim, rshape, ndarray->dtype);
rarray = (uint8_t *)result->array;
SWAP(size_t, shape[shift_ax], shape[ULAB_MAX_DIMS - 1]);
SWAP(size_t, rshape[shift_ax], rshape[ULAB_MAX_DIMS - 1]);
@ -95,6 +98,8 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
SWAP(int32_t, rstrides[shift_ax], rstrides[ULAB_MAX_DIMS - 1]);
}
uint8_t *rarray = (uint8_t *)result->array;
#if ULAB_MAX_DIMS > 3
size_t i = 0;
do {
@ -151,6 +156,180 @@ static mp_obj_t transform_compress(size_t n_args, const mp_obj_t *pos_args, mp_m
MP_DEFINE_CONST_FUN_OBJ_KW(transform_compress_obj, 2, transform_compress);
#endif /* ULAB_NUMPY_HAS_COMPRESS */
#if ULAB_NUMPY_HAS_DELETE
static mp_obj_t transform_delete(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_rom_obj = mp_const_none } },
{ MP_QSTR_, MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_rom_obj = mp_const_none } },
{ MP_QSTR_axis, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_rom_obj = mp_const_none } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
if(!mp_obj_is_type(args[0].u_obj, &ulab_ndarray_type)) {
mp_raise_TypeError(translate("first argument must be an ndarray"));
}
ndarray_obj_t *ndarray = MP_OBJ_TO_PTR(args[0].u_obj);
uint8_t *array = (uint8_t *)ndarray->array;
mp_obj_t indices = args[1].u_obj;
mp_obj_t axis = args[2].u_obj;
int8_t shift_ax;
size_t axis_len;
if(axis != mp_const_none) {
int8_t ax = tools_get_axis(axis, ndarray->ndim);
shift_ax = ULAB_MAX_DIMS - ndarray->ndim + ax;
axis_len = ndarray->shape[shift_ax];
} else {
axis_len = ndarray->len;
}
size_t index_len;
if(mp_obj_is_int(indices)) {
index_len = 1;
} else {
if(mp_obj_len_maybe(indices) == MP_OBJ_NULL) {
mp_raise_TypeError(translate("wrong index type"));
}
index_len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len_maybe(indices));
}
if(index_len > axis_len) {
mp_raise_ValueError(translate("wrong length of index array"));
}
size_t *index_array = m_new(size_t, index_len);
if(mp_obj_is_int(indices)) {
ssize_t value = (ssize_t)mp_obj_get_int(indices);
if(value < 0) {
value += axis_len;
}
if((value < 0) || (value > (ssize_t)axis_len)) {
mp_raise_ValueError(translate("index is out of bounds"));
} else {
*index_array++ = (size_t)value;
}
} else {
mp_obj_iter_buf_t iter_buf;
mp_obj_t item, iterable = mp_getiter(indices, &iter_buf);
while((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
ssize_t value = (ssize_t)mp_obj_get_int(item);
if(value < 0) {
value += axis_len;
}
if((value < 0) || (value > (ssize_t)axis_len)) {
mp_raise_ValueError(translate("index is out of bounds"));
} else {
*index_array++ = (size_t)value;
}
}
}
// sort the array, since it is not guaranteed that the input is sorted
HEAPSORT1(size_t, index_array, 1, index_len);
size_t *shape = m_new(size_t, ULAB_MAX_DIMS);
memcpy(shape, ndarray->shape, ULAB_MAX_DIMS * sizeof(size_t));
size_t *rshape = m_new(size_t, ULAB_MAX_DIMS);
memcpy(rshape, ndarray->shape, ULAB_MAX_DIMS * sizeof(size_t));
int32_t *strides = m_new(int32_t, ULAB_MAX_DIMS);
memcpy(strides, ndarray->strides, ULAB_MAX_DIMS * sizeof(int32_t));
int32_t *rstrides = m_new(int32_t, ULAB_MAX_DIMS);
ndarray_obj_t *result = NULL;
if(axis == mp_const_none) {
result = ndarray_new_linear_array(ndarray->len - index_len, ndarray->dtype);
memset(rstrides, 0, ndarray->ndim * sizeof(int32_t));
rstrides[ULAB_MAX_DIMS - 1] = ndarray->itemsize;
memset(rshape, 0, sizeof(size_t) * ULAB_MAX_DIMS);
// rshape[ULAB_MAX_DIMS - 1] = 0;
} else {
rshape[shift_ax] = shape[shift_ax] - index_len;
result = ndarray_new_dense_ndarray(ndarray->ndim, rshape, ndarray->dtype);
SWAP(size_t, shape[shift_ax], shape[ULAB_MAX_DIMS - 1]);
SWAP(size_t, rshape[shift_ax], rshape[ULAB_MAX_DIMS - 1]);
SWAP(int32_t, strides[shift_ax], strides[ULAB_MAX_DIMS - 1]);
memcpy(rstrides, result->strides, ULAB_MAX_DIMS * sizeof(int32_t));
SWAP(int32_t, rstrides[shift_ax], rstrides[ULAB_MAX_DIMS - 1]);
}
uint8_t *rarray = (uint8_t *)result->array;
index_array -= index_len;
size_t count = 0;
#if ULAB_MAX_DIMS > 3
size_t i = 0;
do {
#endif
#if ULAB_MAX_DIMS > 2
size_t j = 0;
do {
#endif
#if ULAB_MAX_DIMS > 1
size_t k = 0;
do {
#endif
size_t l = 0;
do {
if(count == *index_array) {
index_array++;
} else {
memcpy(rarray, array, ndarray->itemsize);
rarray += rstrides[ULAB_MAX_DIMS - 1];
}
array += strides[ULAB_MAX_DIMS - 1];
l++;
count++;
} while(l < shape[ULAB_MAX_DIMS - 1]);
if(axis != mp_const_none) {
index_array -= index_len;
count = 0;
}
#if ULAB_MAX_DIMS > 1
array -= strides[ULAB_MAX_DIMS - 1] * shape[ULAB_MAX_DIMS - 1];
array += strides[ULAB_MAX_DIMS - 2];
rarray -= rstrides[ULAB_MAX_DIMS - 1] * rshape[ULAB_MAX_DIMS - 1];
rarray += rstrides[ULAB_MAX_DIMS - 2];
k++;
} while(k < shape[ULAB_MAX_DIMS - 2]);
#endif
#if ULAB_MAX_DIMS > 2
array -= strides[ULAB_MAX_DIMS - 2] * shape[ULAB_MAX_DIMS - 2];
array += strides[ULAB_MAX_DIMS - 3];
rarray -= rstrides[ULAB_MAX_DIMS - 2] * rshape[ULAB_MAX_DIMS - 2];
rarray += rstrides[ULAB_MAX_DIMS - 3];
j++;
} while(j < shape[ULAB_MAX_DIMS - 3]);
#endif
#if ULAB_MAX_DIMS > 3
array -= strides[ULAB_MAX_DIMS - 3] * shape[ULAB_MAX_DIMS - 3];
array += strides[ULAB_MAX_DIMS - 4];
rarray -= rstrides[ULAB_MAX_DIMS - 2] * rshape[ULAB_MAX_DIMS - 2];
rarray += rstrides[ULAB_MAX_DIMS - 3];
i++;
} while(i < shape[ULAB_MAX_DIMS - 4]);
#endif
return MP_OBJ_FROM_PTR(result);
}
MP_DEFINE_CONST_FUN_OBJ_KW(transform_delete_obj, 2, transform_delete);
#endif /* ULAB_NUMPY_HAS_DELETE */
#if ULAB_MAX_DIMS > 1
#if ULAB_NUMPY_HAS_DOT
//| def dot(m1: ulab.numpy.ndarray, m2: ulab.numpy.ndarray) -> Union[ulab.numpy.ndarray, _float]:

View file

@ -21,9 +21,9 @@
#include "../ulab.h"
#include "../ulab_tools.h"
#include "transform.h"
MP_DECLARE_CONST_FUN_OBJ_KW(transform_compress_obj);
MP_DECLARE_CONST_FUN_OBJ_KW(transform_delete_obj);
MP_DECLARE_CONST_FUN_OBJ_2(transform_dot_obj);
#endif

View file

@ -438,6 +438,10 @@
#define ULAB_NUMPY_HAS_CROSS (1)
#endif
#ifndef ULAB_NUMPY_HAS_DELETE
#define ULAB_NUMPY_HAS_DELETE (1)
#endif
#ifndef ULAB_NUMPY_HAS_DIFF
#define ULAB_NUMPY_HAS_DIFF (1)
#endif

View file

@ -15,34 +15,35 @@ the firmware was compiled with complex support.
7. `numpy.compress\* <#compress>`__
8. `numpy.conjugate\* <#conjugate>`__
9. `numpy.convolve\* <#convolve>`__
10. `numpy.diff <#diff>`__
11. `numpy.dot <#dot>`__
12. `numpy.equal <#equal>`__
13. `numpy.flip\* <#flip>`__
14. `numpy.imag\* <#imag>`__
15. `numpy.interp <#interp>`__
16. `numpy.isfinite <#isfinite>`__
17. `numpy.isinf <#isinf>`__
18. `numpy.load <#load>`__
19. `numpy.max <#max>`__
20. `numpy.maximum <#maximum>`__
21. `numpy.mean <#mean>`__
22. `numpy.median <#median>`__
23. `numpy.min <#min>`__
24. `numpy.minimum <#minimum>`__
25. `numpy.not_equal <#equal>`__
26. `numpy.polyfit <#polyfit>`__
27. `numpy.polyval <#polyval>`__
28. `numpy.real\* <#real>`__
29. `numpy.roll <#roll>`__
30. `numpy.save <#save>`__
31. `numpy.sort <#sort>`__
32. `numpy.sort_complex\* <#sort_complex>`__
33. `numpy.std <#std>`__
34. `numpy.sum <#sum>`__
35. `numpy.trace <#trace>`__
36. `numpy.trapz <#trapz>`__
37. `numpy.where <#where>`__
10. `numpy.delete <#delete>`__
11. `numpy.diff <#diff>`__
12. `numpy.dot <#dot>`__
13. `numpy.equal <#equal>`__
14. `numpy.flip\* <#flip>`__
15. `numpy.imag\* <#imag>`__
16. `numpy.interp <#interp>`__
17. `numpy.isfinite <#isfinite>`__
18. `numpy.isinf <#isinf>`__
19. `numpy.load <#load>`__
20. `numpy.max <#max>`__
21. `numpy.maximum <#maximum>`__
22. `numpy.mean <#mean>`__
23. `numpy.median <#median>`__
24. `numpy.min <#min>`__
25. `numpy.minimum <#minimum>`__
26. `numpy.not_equal <#equal>`__
27. `numpy.polyfit <#polyfit>`__
28. `numpy.polyval <#polyval>`__
29. `numpy.real\* <#real>`__
30. `numpy.roll <#roll>`__
31. `numpy.save <#save>`__
32. `numpy.sort <#sort>`__
33. `numpy.sort_complex\* <#sort_complex>`__
34. `numpy.std <#std>`__
35. `numpy.sum <#sum>`__
36. `numpy.trace <#trace>`__
37. `numpy.trapz <#trapz>`__
38. `numpy.where <#where>`__
all
---
@ -414,6 +415,67 @@ accept complex arrays.
delete
------
``numpy``:
https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html
The function returns a new array with sub-arrays along an axis deleted.
It takes two positional arguments, the array, and the indices, which
will be removed, as well as the ``axis`` keyword argument with a default
value of ``None``. If the ``axis`` is ``None``, the will be flattened
first.
The second positional argument can be a scalar, or any ``micropython``
iterable. Since ``range`` can also be passed in place of the indices,
slicing can be emulated. If the indices are negative, the elements are
counted from the end of the axis.
Note that the function creates a copy of the indices first, because it
is not guaranteed that the indices are ordered. Keep this in mind, when
working with large arrays.
.. code::
# code to be run in micropython
from ulab import numpy as np
a = np.array(range(25), dtype=np.uint8).reshape((5,5))
print('a:\n', a)
print('\naxis = 0\n', np.delete(a, 2, axis=0))
print('\naxis = 1\n', np.delete(a, -2, axis=1))
print('\naxis = None\n', np.delete(a, [0, 1, 2, 22]))
.. parsed-literal::
a:
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[10, 11, 12, 13, 14],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint8)
axis = 0
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint8)
axis = 1
array([[0, 1, 2, 4],
[5, 6, 7, 9],
[10, 11, 12, 14],
[15, 16, 17, 19],
[20, 21, 22, 24]], dtype=uint8)
axis = None
array([3, 4, 5, ..., 21, 23, 24], dtype=uint8)
diff
----

View file

@ -34,8 +34,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T19:06:59.366828Z",
"start_time": "2022-01-12T19:06:59.359952Z"
"end_time": "2022-01-12T16:41:02.299473Z",
"start_time": "2022-01-12T16:41:02.282389Z"
}
},
"outputs": [],
@ -52,8 +52,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T19:07:00.590084Z",
"start_time": "2022-01-12T19:07:00.563790Z"
"end_time": "2022-01-12T16:41:02.475299Z",
"start_time": "2022-01-12T16:41:02.401569Z"
}
},
"outputs": [],
@ -241,6 +241,7 @@
"1. [numpy.compress*](#compress)\n",
"1. [numpy.conjugate*](#conjugate)\n",
"1. [numpy.convolve*](#convolve)\n",
"1. [numpy.delete](#delete)\n",
"1. [numpy.diff](#diff)\n",
"1. [numpy.dot](#dot)\n",
"1. [numpy.equal](#equal)\n",
@ -740,6 +741,74 @@
"print(np.convolve(x, y))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## delete\n",
"\n",
"`numpy`: https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html\n",
"\n",
"The function returns a new array with sub-arrays along an axis deleted. It takes two positional arguments, the array, and the indices, which will be removed, as well as the `axis` keyword argument with a default value of `None`. If the `axis` is `None`, the will be flattened first. \n",
"\n",
"The second positional argument can be a scalar, or any `micropython` iterable. Since `range` can also be passed in place of the indices, slicing can be emulated. If the indices are negative, the elements are counted from the end of the axis.\n",
"\n",
"Note that the function creates a copy of the indices first, because it is not guaranteed that the indices are ordered. Keep this in mind, when working with large arrays."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T17:03:29.099233Z",
"start_time": "2022-01-12T17:03:29.084117Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a:\n",
" array([[0, 1, 2, 3, 4],\n",
" [5, 6, 7, 8, 9],\n",
" [10, 11, 12, 13, 14],\n",
" [15, 16, 17, 18, 19],\n",
" [20, 21, 22, 23, 24]], dtype=uint8)\n",
"\n",
"axis = 0\n",
" array([[0, 1, 2, 3, 4],\n",
" [5, 6, 7, 8, 9],\n",
" [15, 16, 17, 18, 19],\n",
" [20, 21, 22, 23, 24]], dtype=uint8)\n",
"\n",
"axis = 1\n",
" array([[0, 1, 2, 4],\n",
" [5, 6, 7, 9],\n",
" [10, 11, 12, 14],\n",
" [15, 16, 17, 19],\n",
" [20, 21, 22, 24]], dtype=uint8)\n",
"\n",
"axis = None\n",
" array([3, 4, 5, ..., 21, 23, 24], dtype=uint8)\n",
"\n",
"\n"
]
}
],
"source": [
"%%micropython -unix 1\n",
"\n",
"from ulab import numpy as np\n",
"\n",
"a = np.array(range(25), dtype=np.uint8).reshape((5,5))\n",
"print('a:\\n', a)\n",
"print('\\naxis = 0\\n', np.delete(a, 2, axis=0))\n",
"print('\\naxis = 1\\n', np.delete(a, -2, axis=1))\n",
"print('\\naxis = None\\n', np.delete(a, [0, 1, 2, 22]))"
]
},
{
"cell_type": "markdown",
"metadata": {},

View file

@ -4,6 +4,24 @@ Wed, 12 Jan 2022
implement numpy.save, numpy.load
Wed, 12 Jan 2022
version 4.1.1
fix complex printout for long arrays
Wed, 12 Jan 2022
version 4.1.0
add numpy.delete
Sat, 8 Jan 2022
version 4.0.0
add complex support, .tolist() method, .imag, .real array properties, compress, conjugate, imag, real, sort_complex functions
Fri, 3 Dec 2021
version 3.3.8

View file

@ -17,8 +17,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T19:13:49.823884Z",
"start_time": "2022-01-12T19:13:49.814198Z"
"end_time": "2022-01-12T17:00:33.582729Z",
"start_time": "2022-01-12T17:00:33.566591Z"
}
},
"outputs": [
@ -215,11 +215,11 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T19:13:56.492894Z",
"start_time": "2022-01-12T19:13:55.202514Z"
"end_time": "2022-01-12T17:03:49.038101Z",
"start_time": "2022-01-12T17:03:48.886617Z"
}
},
"outputs": [],
@ -256,11 +256,11 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2022-01-12T19:15:22.428830Z",
"start_time": "2022-01-12T19:15:17.704906Z"
"end_time": "2022-01-12T17:03:52.084601Z",
"start_time": "2022-01-12T17:03:50.354118Z"
}
},
"outputs": [],

26
tests/2d/numpy/delete.py Normal file
View file

@ -0,0 +1,26 @@
try:
from ulab import numpy as np
except:
import numpy as np
np.set_printoptions(threshold=200)
dtypes = (np.uint8, np.int8, np.uint16, np.int16, np.float)
for dtype in dtypes:
a = np.array(range(25), dtype=dtype).reshape((5,5))
print(np.delete(a, [1, 2], axis=0))
print(np.delete(a, [1, 2], axis=1))
print(np.delete(a, [1, 5, 10]))
for dtype in dtypes:
a = np.array(range(25), dtype=dtype).reshape((5,5))
print(np.delete(a, 2, axis=0))
print(np.delete(a, 2, axis=1))
print(np.delete(a, 2))
for dtype in dtypes:
a = np.array(range(25), dtype=dtype).reshape((5,5))
print(np.delete(a, -3, axis=0))
print(np.delete(a, -3, axis=1))
print(np.delete(a, -3))

View file

@ -0,0 +1,145 @@
array([[0, 1, 2, 3, 4],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint8)
array([[0, 3, 4],
[5, 8, 9],
[10, 13, 14],
[15, 18, 19],
[20, 23, 24]], dtype=uint8)
array([0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=uint8)
array([[0, 1, 2, 3, 4],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int8)
array([[0, 3, 4],
[5, 8, 9],
[10, 13, 14],
[15, 18, 19],
[20, 23, 24]], dtype=int8)
array([0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=int8)
array([[0, 1, 2, 3, 4],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint16)
array([[0, 3, 4],
[5, 8, 9],
[10, 13, 14],
[15, 18, 19],
[20, 23, 24]], dtype=uint16)
array([0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=uint16)
array([[0, 1, 2, 3, 4],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int16)
array([[0, 3, 4],
[5, 8, 9],
[10, 13, 14],
[15, 18, 19],
[20, 23, 24]], dtype=int16)
array([0, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=int16)
array([[0.0, 1.0, 2.0, 3.0, 4.0],
[15.0, 16.0, 17.0, 18.0, 19.0],
[20.0, 21.0, 22.0, 23.0, 24.0]], dtype=float64)
array([[0.0, 3.0, 4.0],
[5.0, 8.0, 9.0],
[10.0, 13.0, 14.0],
[15.0, 18.0, 19.0],
[20.0, 23.0, 24.0]], dtype=float64)
array([0.0, 2.0, 3.0, 4.0, 6.0, 7.0, 8.0, 9.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0], dtype=float64)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint8)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=uint8)
array([0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=uint8)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int8)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=int8)
array([0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=int8)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint16)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=uint16)
array([0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=uint16)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int16)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=int16)
array([0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], dtype=int16)
array([[0.0, 1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0, 9.0],
[15.0, 16.0, 17.0, 18.0, 19.0],
[20.0, 21.0, 22.0, 23.0, 24.0]], dtype=float64)
array([[0.0, 1.0, 3.0, 4.0],
[5.0, 6.0, 8.0, 9.0],
[10.0, 11.0, 13.0, 14.0],
[15.0, 16.0, 18.0, 19.0],
[20.0, 21.0, 23.0, 24.0]], dtype=float64)
array([0.0, 1.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0], dtype=float64)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint8)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=uint8)
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24], dtype=uint8)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int8)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=int8)
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24], dtype=int8)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=uint16)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=uint16)
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24], dtype=uint16)
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9],
[15, 16, 17, 18, 19],
[20, 21, 22, 23, 24]], dtype=int16)
array([[0, 1, 3, 4],
[5, 6, 8, 9],
[10, 11, 13, 14],
[15, 16, 18, 19],
[20, 21, 23, 24]], dtype=int16)
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24], dtype=int16)
array([[0.0, 1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0, 9.0],
[15.0, 16.0, 17.0, 18.0, 19.0],
[20.0, 21.0, 22.0, 23.0, 24.0]], dtype=float64)
array([[0.0, 1.0, 3.0, 4.0],
[5.0, 6.0, 8.0, 9.0],
[10.0, 11.0, 13.0, 14.0],
[15.0, 16.0, 18.0, 19.0],
[20.0, 21.0, 23.0, 24.0]], dtype=float64)
array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 23.0, 24.0], dtype=float64)

View file

@ -160,10 +160,10 @@ square root:
[3.741657386773941, 3.872983346207417]]]], dtype=float64)
array:
array([0j, 1.0+0.0j, 2.0+0.0j, ..., 13.0+0.0j, 14.0+0.0j, 15.0+0.0j], dtype=complex)
array([0.0+0.0j, 1.0+0.0j, 2.0+0.0j, ..., 13.0+0.0j, 14.0+0.0j, 15.0+0.0j], dtype=complex)
square root:
array([0j, 1.0+0.0j, 1.414213562373095+0.0j, ..., 3.605551275463989+0.0j, 3.741657386773941+0.0j, 3.872983346207417+0.0j], dtype=complex)
array([0.0+0.0j, 1.0+0.0j, 1.414213562373095+0.0j, ..., 3.605551275463989+0.0j, 3.741657386773941+0.0j, 3.872983346207417+0.0j], dtype=complex)
array:
array([[[[0.0+0.0j, 1.0+0.0j],

View file

@ -450,7 +450,7 @@ imaginary part:
array:
array([0j, 1.0+0.0j, 2.0+0.0j, ..., 13.0+0.0j, 14.0+0.0j, 15.0+0.0j], dtype=complex)
array([0.0+0.0j, 1.0+0.0j, 2.0+0.0j, ..., 13.0+0.0j, 14.0+0.0j, 15.0+0.0j], dtype=complex)
real part:
array([0.0, 1.0, 2.0, ..., 13.0, 14.0, 15.0], dtype=float64)