update docs

This commit is contained in:
Zoltán Vörös 2021-06-17 21:58:42 +02:00
parent 947ef80f9f
commit 353eec999b
4 changed files with 97 additions and 19 deletions

View file

@ -27,7 +27,7 @@ copyright = '2019-2021, Zoltán Vörös and contributors'
author = 'Zoltán Vörös'
# The full version, including alpha/beta/rc tags
release = '3.0.0'
release = '3.0.1'
# -- General configuration ---------------------------------------------------

View file

@ -869,8 +869,9 @@ array, while the methods return a new array-like object.
6. `.reshape <#.reshape>`__
7. `.shape <#.shape>`__
8. `.size <#.size>`__
9. `.transpose <.#transpose>`__
10. `.sort <#.sort>`__
9. `.T <#.transpose>`__
10. `.transpose <#.transpose>`__
11. `.sort <#.sort>`__
.byteswap
~~~~~~~~~
@ -1201,6 +1202,11 @@ in the array.
.T
The ``.T`` property of the ``ndarray`` is equivalent to
`.transpose <#.transpose>`__.
.tobytes
~~~~~~~~
@ -1264,10 +1270,10 @@ dimensions is larger than 1.
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]], dtype=np.uint8)
print('a:\n', a)
print('shape of a:', a.shape())
print('shape of a:', a.shape)
a.transpose()
print('\ntranspose of a:\n', a)
print('shape of a:', a.shape())
print('shape of a:', a.shape)
.. parsed-literal::
@ -1287,6 +1293,34 @@ dimensions is larger than 1.
The transpose of the array can also be gotten through the ``T``
property:
.. code::
# code to be run in micropython
from ulab import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.uint8)
print('a:\n', a)
print('\ntranspose of a:\n', a.T)
.. parsed-literal::
a:
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]], dtype=uint8)
transpose of a:
array([[1, 4, 7],
[2, 5, 8],
[3, 6, 9]], dtype=uint8)
.sort
~~~~~
@ -1365,10 +1399,10 @@ length of the first axis.
print("a:\t", a)
print("length of a: ", len(a))
print("shape of a: ", a.shape())
print("shape of a: ", a.shape)
print("\nb:\t", b)
print("length of b: ", len(b))
print("shape of b: ", b.shape())
print("shape of b: ", b.shape)
.. parsed-literal::

View file

@ -61,7 +61,7 @@
"author = 'Zoltán Vörös'\n",
"\n",
"# The full version, including alpha/beta/rc tags\n",
"release = '3.0.0'\n",
"release = '3.0.1'\n",
"\n",
"\n",
"# -- General configuration ---------------------------------------------------\n",
@ -435,9 +435,8 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
"name": "python3",
"display_name": "Python 3.8.5 64-bit ('base': conda)"
},
"language_info": {
"codemirror_mode": {
@ -497,6 +496,9 @@
"_Feature"
],
"window_display": false
},
"interpreter": {
"hash": "ce9a02f9f7db620716422019cafa4bc1786ca85daa298b819f6da075e7993842"
}
},
"nbformat": 4,

View file

@ -1324,7 +1324,8 @@
"1. [.reshape](#.reshape)\n",
"1. [.shape](#.shape)\n",
"1. [.size](#.size)\n",
"1. [.transpose](.#transpose)\n",
"1. [.T](#.transpose)\n",
"1. [.transpose](#.transpose)\n",
"1. [.sort](#.sort)"
]
},
@ -1779,6 +1780,15 @@
"print(\"size of b:\", b.size)"
]
},
{
"source": [
".T\n",
"\n",
"The `.T` property of the `ndarray` is equivalent to [.transpose](#.transpose)."
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
@ -1883,10 +1893,40 @@
"\n",
"a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]], dtype=np.uint8)\n",
"print('a:\\n', a)\n",
"print('shape of a:', a.shape())\n",
"print('shape of a:', a.shape)\n",
"a.transpose()\n",
"print('\\ntranspose of a:\\n', a)\n",
"print('shape of a:', a.shape())"
"print('shape of a:', a.shape)"
]
},
{
"source": [
"The transpose of the array can also be gotten through the `T` property:"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"a:\n array([[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]], dtype=uint8)\n\ntranspose of a:\n array([[1, 4, 7],\n [2, 5, 8],\n [3, 6, 9]], dtype=uint8)\n\n\n"
]
}
],
"source": [
"%%micropython -unix 1\n",
"\n",
"from ulab import numpy as np\n",
"\n",
"a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=np.uint8)\n",
"print('a:\\n', a)\n",
"print('\\ntranspose of a:\\n', a.T)"
]
},
{
@ -2016,10 +2056,10 @@
"\n",
"print(\"a:\\t\", a)\n",
"print(\"length of a: \", len(a))\n",
"print(\"shape of a: \", a.shape())\n",
"print(\"shape of a: \", a.shape)\n",
"print(\"\\nb:\\t\", b)\n",
"print(\"length of b: \", len(b))\n",
"print(\"shape of b: \", b.shape())"
"print(\"shape of b: \", b.shape)"
]
},
{
@ -3338,9 +3378,8 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
"name": "python3",
"display_name": "Python 3.8.5 64-bit ('base': conda)"
},
"language_info": {
"codemirror_mode": {
@ -3400,6 +3439,9 @@
"_Feature"
],
"window_display": false
},
"interpreter": {
"hash": "ce9a02f9f7db620716422019cafa4bc1786ca85daa298b819f6da075e7993842"
}
},
"nbformat": 4,