compute.py finalisiert und formatiert

This commit is contained in:
englingvi103466 committed 2026-10-15 13:27:12 +02:00
1 parent dade4222fc
commit 658f1589ae
2 files changed
+10 -7

No files matched your search

Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+4 -7
View File
@@ -12,8 +12,7 @@ from typing import List
def matmul( def matmul(
matrix_a: List[List[float]], matrix_a: List[List[float]], matrix_b: List[List[float]]
matrix_b: List[List[float]]
) -> List[List[float]]: ) -> List[List[float]]:
"""Multiply two 2D matrices. """Multiply two 2D matrices.
@@ -142,10 +141,8 @@ def rot_2D(theta: float) -> List[List[float]]:
""" """
c = math.cos(theta) c = math.cos(theta)
s = math.sin(theta) s = math.sin(theta)
return [ return [[c, -s], [s, c]]
[c, -s],
[s, c]
]
if __name__ == "__main__": if __name__ == "__main__":
# Testdaten für die Demonstration # Testdaten für die Demonstration
@@ -167,4 +164,4 @@ if __name__ == "__main__":
print(f"rot_2D (pi / 2 radians / 90 degrees):") print(f"rot_2D (pi / 2 radians / 90 degrees):")
rotation_matrix = rot_2D(angle) rotation_matrix = rot_2D(angle)
for row in rotation_matrix: for row in rotation_matrix:
print([round(val, 4) for val in row]) print([round(val, 4) for val in row])