{"id":23116063,"url":"https://github.com/samueljamesbell/prettymatrix","last_synced_at":"2025-08-16T21:32:17.506Z","repository":{"id":47099340,"uuid":"121510832","full_name":"samueljamesbell/prettymatrix","owner":"samueljamesbell","description":"Python pretty printer for matrices and column vectors.","archived":false,"fork":false,"pushed_at":"2022-12-08T07:44:47.000Z","size":62,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-12T17:44:29.019Z","etag":null,"topics":["matrices","numpy","pretty-print","rendering","stringify","vector"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samueljamesbell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-14T12:56:57.000Z","updated_at":"2021-09-13T17:12:20.000Z","dependencies_parsed_at":"2022-09-26T19:01:06.331Z","dependency_job_id":null,"html_url":"https://github.com/samueljamesbell/prettymatrix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/samueljamesbell/prettymatrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueljamesbell%2Fprettymatrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueljamesbell%2Fprettymatrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueljamesbell%2Fprettymatrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueljamesbell%2Fprettymatrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samueljamesbell","download_url":"https://codeload.github.com/samueljamesbell/prettymatrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samueljamesbell%2Fprettymatrix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270775799,"owners_count":24642961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matrices","numpy","pretty-print","rendering","stringify","vector"],"created_at":"2024-12-17T04:10:50.051Z","updated_at":"2025-08-16T21:32:17.233Z","avatar_url":"https://github.com/samueljamesbell.png","language":"Python","readme":"prettymatrix\n============\n\n[![Build Status](https://travis-ci.org/samueljamesbell/prettymatrix.svg?branch=master)](https://travis-ci.org/samueljamesbell/prettymatrix)\n\nStruggling to tell your rows from your columns?\n\n`prettymatrix` creates human-friendly string representations of your numpy matrices and vectors, just like you're used\nto.\n\nInstallation\n------------\nAvailable through pip:\n\n```\npip install prettymatrix\n```\n\nExamples\n--------\n### Stringify a single matrix\n```\nimport numpy as np\nimport prettymatrix\n\nM = np.array([['1', '22'], ['333', '4444']])\n\nprint(prettymatrix.matrix_to_string(M))\n\n# =\u003e\n#  ┌          ┐\n#  │ 1   22   │\n#  │ 333 4444 │\n#  └          ┘\n#\n\n# We condense large matrices to a readable size\nN = prettymatrix.matrix_to_string(np.full((1000,1000), '0'))\n\nprint(prettymatrix.matrix_to_string(N))\n\n# =\u003e\n#  ┌                   ┐\n#  │ 0 0 0 … … … 0 0 0 │\n#  │ 0 0 0 … … … 0 0 0 │\n#  │ 0 0 0 … … … 0 0 0 │\n#  │ … … … … … … … … … │\n#  │ … … … … … … … … … │\n#  │ … … … … … … … … … │\n#  │ 0 0 0 … … … 0 0 0 │\n#  │ 0 0 0 … … … 0 0 0 │\n#  │ 0 0 0 … … … 0 0 0 │\n#  └                   ┘\n#\n```\n\nAnnotate your matrix with a name:\n\n```\nimport numpy as np\nimport prettymatrix\n\nM = np.array([['0'], ['0']])\n\nprint(prettymatrix.matrix_to_string(M, name='M_x_y'))\n\n# =\u003e\n#  M_x_y\n#  ┌   ┐\n#  │ 0 │\n#  │ 0 │\n#  └   ┘\n#\n```\n\nOr its dimensions:\n\n```\nimport numpy as np\nimport prettymatrix\n\nM = np.array([['0'], ['0']])\n\nprint(prettymatrix.matrix_to_string(M, include_dimensions=True))\n\n# =\u003e\n#  (2x1)\n#  ┌   ┐\n#  │ 0 │\n#  │ 0 │\n#  └   ┘\n#\n```\n\n### Stringify a multiple matrices in a row\n```\nimport numpy as np\nimport prettymatrix\n\nM = np.array([['1', '22'], ['333', '4444']])\n\nprint(prettymatrix.matrices_to_string(M, M))\n\n# =\u003e\n#  ┌          ┐ ┌          ┐\n#  │ 1   22   │ │ 1   22   │\n#  │ 333 4444 │ │ 333 4444 │\n#  └          ┘ └          ┘\n#\n```\n\n### Stringify an expression containing matrices and operators\n```\nimport numpy as np\nimport prettymatrix\n\nM = np.array([['1', '1'], ['1', '1']])\n\nprint(prettymatrix.expression_to_string(M,\n                                        prettymatrix.HADAMARD,\n                                        M,\n                                        prettymatrix.EQUALS,\n                                        M,\n                                        names=['M', 'M', 'M'),\n                                        include_dimensions=True)\n\n# =\u003e\n#  M         M         M\n#  (2x2)     (2x2)     (2x2)\n#  ┌     ┐ ∘ ┌     ┐ = ┌     ┐\n#  │ 1 1 │   │ 1 1 │   │ 1 1 │\n#  │ 1 1 │   │ 1 1 │   │ 1 1 │\n#  └     ┘   └     ┘   └     ┘\n#\n```\n\nTODO\n----\n- [ ] Support rendering transpose and inverse operations\n- [ ] Allow wrapping of matrices and vectors in functions, e.g. `tanh`\n- [ ] Highlight matching dimensions in the same colour\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueljamesbell%2Fprettymatrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamueljamesbell%2Fprettymatrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamueljamesbell%2Fprettymatrix/lists"}