compute.py gelöscht
This commit is contained in:
parent
a93f84c60e
commit
16ec325777
31
compute.py
31
compute.py
@ -1,31 +0,0 @@
|
|||||||
# compute.py (relevante Funktionen)
|
|
||||||
from tabulate import tabulate
|
|
||||||
|
|
||||||
import math
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
Matrix = List[List[float]]
|
|
||||||
|
|
||||||
def rot_2D(theta: float) -> Matrix:
|
|
||||||
cos_theta = math.cos(theta)
|
|
||||||
sin_theta = math.sin(theta)
|
|
||||||
return [
|
|
||||||
[cos_theta, -sin_theta],
|
|
||||||
[sin_theta, cos_theta]
|
|
||||||
]
|
|
||||||
|
|
||||||
def matmul(a: Matrix, b: Matrix) -> Matrix:
|
|
||||||
if len(a[0]) != len(b):
|
|
||||||
raise ValueError("Spalten von A müssen gleich Zeilen von B sein.")
|
|
||||||
result = [[0]*len(b[0]) for _ in range(len(a))]
|
|
||||||
for i in range(len(a)):
|
|
||||||
for j in range(len(b[0])):
|
|
||||||
for k in range(len(b)):
|
|
||||||
result[i][j] += a[i][k] * b[k][j]
|
|
||||||
return result
|
|
||||||
|
|
||||||
if _name_ == "_main_":
|
|
||||||
# habe ich alles selbst programmiert
|
|
||||||
matrix_a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
||||||
print("Test Matrix A:")
|
|
||||||
print(tabulate(matrix_a)) ##
|
|
||||||
Loading…
x
Reference in New Issue
Block a user