diff --git a/ pyproject.toml b/ pyproject.toml index a5073ae..bf2c9e7 100644 --- a/ pyproject.toml +++ b/ pyproject.toml @@ -1,3 +1,4 @@ [project] name = "matrixmania" -version = "0.1.0 \ No newline at end of file +version = "0.1.0 +dependencies = ["tabulate", "ruff"] \ No newline at end of file diff --git a/compute.py b/compute.py index 75c6bf4..3238529 100644 --- a/compute.py +++ b/compute.py @@ -1,7 +1,7 @@ """Modul zur Matrizenmultiplikation.""" from __future__ import annotations import math - +from tabulate import tabulate #test Matrix = list[list[float]] @@ -104,6 +104,7 @@ def rot_2D(m: Matrix | float) -> Matrix: if __name__ == "__main__": # Beispiel 1: klassischer Fall 2x3 * 3x2 -> 2x2 + print(tabulate(rot_2D(1.0))) a1 = [[1, 2, 3], [4, 5, 6]] b1 = [[7, 8], @@ -144,26 +145,5 @@ if __name__ == "__main__": expected7 = [[4, 1], [5, 2], [6, 3]] - got7 = rotate(m7) - assert got7 == expected7, f"Beispiel 7 fehlgeschlagen: {got7}" - print("Beispiel 7 ok:", got7) - # Beispiel 8: Rotation einer quadratischen 3x3 Matrix - m8 = [[1, 2, 3], - [4, 5, 6], - [7, 8, 9]] - expected8 = [[7, 4, 1], - [8, 5, 2], - [9, 6, 3]] - got8 = rotate(m8) - assert got8 == expected8, f"Beispiel 8 fehlgeschlagen: {got8}" - print("Beispiel 8 ok:", got8) - - # Beispiel 9: Fehlerfall – Rotation leerer Matrix - try: - rotate([]) - except ValueError as err: - print("Beispiel 9 ok (Fehler erwartet):", err) - else: - raise AssertionError("ValueError wurde nicht ausgeloest.")