print matrix

This commit is contained in:
Adam Wojdyla 2022-05-09 12:39:29 +02:00
parent 1ad3756107
commit 551db85da0
2 changed files with 225 additions and 25 deletions

185
.gitignore vendored Normal file
View File

@ -0,0 +1,185 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# IPython Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# virtualenv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# idea folder, uncomment if you don't need it
.idea/*

View File

@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 44,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -88,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 45,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -102,7 +102,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 46,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -143,7 +143,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 47,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -153,7 +153,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fa2a66bb49664825b1d21a532749b123",
"model_id": "e28202b168c9439a87a8e3a8369510bf",
"version_major": 2,
"version_minor": 0
},
@ -221,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 48,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -235,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 49,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -277,7 +277,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 50,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -290,7 +290,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 51,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -306,6 +306,9 @@
" reconstructed matrix reconst_matrix, array of singular values s\n",
" \"\"\"\n",
" U,s,V = svd(image,full_matrices=False)\n",
" print(f\"U MATRIX: {U}\")\n",
" print(f\"S MATRIX: {s}\")\n",
" print(f\"V MATRIX: {V}\")\n",
" reconst_matrix = np.dot(U[:,:k],np.dot(np.diag(s[:k]),V[:k,:]))\n",
" \n",
" return reconst_matrix,s"
@ -325,7 +328,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 52,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -366,7 +369,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 53,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -397,7 +400,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 54,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -407,12 +410,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8c4f4db505f14ff6b8176f0e1565bf4b",
"model_id": "2062e134cdf2460191f6c2c6b5ceb1f3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Dropdown(description='img_name', options=('cat', 'astro', 'coffee'), value='cat'), IntSl…"
"interactive(children=(Dropdown(description='img_name', options=('cat', 'astro', 'camera', 'coin', 'clock', 'bl…"
]
},
"metadata": {},
@ -436,7 +439,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 55,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -488,7 +491,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 56,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -523,7 +526,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 57,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -547,7 +550,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 58,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -557,7 +560,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d1463b3eff5d497ba77a77f6d176236e",
"model_id": "5668d9129d224376a65874a9c5d386a5",
"version_major": 2,
"version_minor": 0
},
@ -600,7 +603,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 59,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -638,7 +641,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 60,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -662,7 +665,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 61,
"metadata": {
"pycharm": {
"name": "#%%\n"
@ -672,7 +675,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aed3940b3f2147cda2892b104113dcfe",
"model_id": "525e57d2b7c443099612d9afc2b55f96",
"version_major": 2,
"version_minor": 0
},
@ -692,7 +695,19 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
@ -717,7 +732,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.8.13"
}
},
"nbformat": 4,