aboutsummaryrefslogtreecommitdiff
path: root/solvers.py
diff options
context:
space:
mode:
authorThomas Albers Raviola <thomas@thomaslabs.org>2024-05-14 11:13:31 +0200
committerThomas Albers Raviola <thomas@thomaslabs.org>2024-05-14 11:13:31 +0200
commit45aaf49cb3fe07b006316bacac1318f07a08cc19 (patch)
tree97c07e83ff6847eb6a2c93dcf841e2c4c33e8b9f /solvers.py
* Initial commit
Diffstat (limited to 'solvers.py')
-rw-r--r--solvers.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/solvers.py b/solvers.py
new file mode 100644
index 0000000..7aa9568
--- /dev/null
+++ b/solvers.py
@@ -0,0 +1,20 @@
+"""Routines for solving a linear system of equations."""
+
+import numpy as np
+from numpy.typing import NDArray
+
+
+def gaussian_eliminate(aa: NDArray[np.float_], bb: NDArray[np.float_]) -> NDArray[np.float_] | None:
+ """Solves a linear system of equations (Ax = b) by Gauss-elimination
+
+ Args:
+ aa: Matrix with the coefficients. Shape: (n, n).
+ bb: Right hand side of the equation. Shape: (n,)
+
+ Returns:
+ Vector xx with the solution of the linear equation or None
+ if the equations are linearly dependent.
+ """
+ nn = aa.shape[0]
+ xx = np.zeros((nn,), dtype=np.float_)
+ return xx