Skip to content

Commit

Permalink
feat(gmres.py): add documentation with pdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
loicreynier committed Mar 8, 2024
1 parent d533e0f commit 5c5fae8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions gmres.py/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if command -v nix &> /dev/null; then
use nix
fi

# vim: ft=sh
2 changes: 2 additions & 0 deletions gmres.py/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
/docs
7 changes: 7 additions & 0 deletions gmres.py/Justfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions gmres.py/gmres.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions gmres.py/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
with p; [
matplotlib
numpy
pdoc
scipy
]);
in
pkgs.mkShell {
packages = with pkgs; [
ruff
just
pythonWithPackages
];
}

0 comments on commit 5c5fae8

Please sign in to comment.