Add sample_package with linear algebra tools

- add sample_package:
  + __init__.py => high-level description and imports
  + matrix.py => define a Matrix class
  + vector.py => define a Vector class
  + utils.py => package-wide utilities
- streamline the code snippets in the chapter 11 notebooks
  to align with the sample_package
This commit is contained in:
Alexander Hess 2020-10-27 16:41:22 +01:00
commit 6bcfff481c
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
7 changed files with 770 additions and 40 deletions

View file

@ -272,7 +272,7 @@
"outputs": [],
"source": [
"class Vector:\n",
" \"\"\"A standard one-dimensional vector from linear algebra.\"\"\"\n",
" \"\"\"A one-dimensional vector from linear algebra.\"\"\"\n",
"\n",
" dummy_variable = \"I am a vector\"\n",
"\n",
@ -403,7 +403,7 @@
"data": {
"text/plain": [
"\u001b[0;31mInit signature:\u001b[0m \u001b[0mVector\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mDocstring:\u001b[0m A standard one-dimensional vector from linear algebra.\n",
"\u001b[0;31mDocstring:\u001b[0m A one-dimensional vector from linear algebra.\n",
"\u001b[0;31mType:\u001b[0m type\n",
"\u001b[0;31mSubclasses:\u001b[0m \n"
]
@ -432,7 +432,7 @@
"Help on class Vector in module __main__:\n",
"\n",
"class Vector(builtins.object)\n",
" | A standard one-dimensional vector from linear algebra.\n",
" | A one-dimensional vector from linear algebra.\n",
" | \n",
" | Methods defined here:\n",
" | \n",
@ -484,7 +484,7 @@
"data": {
"text/plain": [
"mappingproxy({'__module__': '__main__',\n",
" '__doc__': 'A standard one-dimensional vector from linear algebra.',\n",
" '__doc__': 'A one-dimensional vector from linear algebra.',\n",
" 'dummy_variable': 'I am a vector',\n",
" 'dummy_method': <function __main__.Vector.dummy_method(self)>,\n",
" '__dict__': <attribute '__dict__' of 'Vector' objects>,\n",
@ -687,7 +687,7 @@
"outputs": [],
"source": [
"class Vector:\n",
" \"\"\"A standard one-dimensional vector from linear algebra.\n",
" \"\"\"A one-dimensional vector from linear algebra.\n",
"\n",
" All entries are converted to floats.\n",
" \"\"\"\n",