From 5c5fae89ad9021b666af7c5f7229df5f2fc4962f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= Date: Fri, 8 Mar 2024 09:13:49 +0000 Subject: [PATCH] feat(gmres.py): add documentation with `pdoc` --- gmres.py/.envrc | 5 +++++ gmres.py/.gitignore | 2 ++ gmres.py/Justfile | 7 +++++++ gmres.py/gmres.py | 4 +--- gmres.py/shell.nix | 2 ++ 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 gmres.py/.envrc create mode 100644 gmres.py/.gitignore create mode 100644 gmres.py/Justfile diff --git a/gmres.py/.envrc b/gmres.py/.envrc new file mode 100644 index 0000000..a82cb63 --- /dev/null +++ b/gmres.py/.envrc @@ -0,0 +1,5 @@ +if command -v nix &> /dev/null; then + use nix +fi + +# vim: ft=sh diff --git a/gmres.py/.gitignore b/gmres.py/.gitignore new file mode 100644 index 0000000..6733299 --- /dev/null +++ b/gmres.py/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +/docs diff --git a/gmres.py/Justfile b/gmres.py/Justfile new file mode 100644 index 0000000..37d382e --- /dev/null +++ b/gmres.py/Justfile @@ -0,0 +1,7 @@ +# Open documentation +open-docs: build-docs + xdg-open ./docs/index.html + +# Build documentation using `pdoc` +build-docs: + pdoc --math ./gmres.py -o ./docs diff --git a/gmres.py/gmres.py b/gmres.py/gmres.py index 4fb8115..e227852 100644 --- a/gmres.py/gmres.py +++ b/gmres.py/gmres.py @@ -106,9 +106,7 @@ def test_arnoldi_iteration( # Check that Q_n is orthogonal # plt.imshow(qn.conj().T @ qn) # plt.show() - assert np.allclose( - qn.conj().T @ qn, np.eye(qn.shape[1]), rtol=rtol, atol=atol - ) + assert np.allclose(qn.conj().T @ qn, np.eye(qn.shape[1]), rtol=rtol, atol=atol) # Check that AQ_n = Q_(n+1)H assert np.allclose(a @ qn, q @ h, rtol=rtol, atol=atol) diff --git a/gmres.py/shell.nix b/gmres.py/shell.nix index 8ee1564..7567994 100644 --- a/gmres.py/shell.nix +++ b/gmres.py/shell.nix @@ -3,12 +3,14 @@ with p; [ matplotlib numpy + pdoc scipy ]); in pkgs.mkShell { packages = with pkgs; [ ruff + just pythonWithPackages ]; }