compute hinzugefügt

This commit is contained in:
rapplu93184 committed 2026-10-20 16:26:10 +02:00
1 parent 2c2063f1c2
commit fa401fe251
2 files changed
+3 -22

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
[project]
name = "matrixmania"
version = "0.1.0
dependencies = ["tabulate", "ruff"]
+2 -22
View File
@@ -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.")