1 parent
b2395fb18d
commit
a2f6206bba
1 file changed
+18
-5
+18
-5
@@ -17,7 +17,18 @@ def matmul(matrix_a:list[list[float]], matrix_b: list[list[float]]) -> list[list
|
|||||||
if len(matrix_a[0]) != len(matrix_b):
|
if len(matrix_a[0]) != len(matrix_b):
|
||||||
raise ValueError("Differing Matrix Size")
|
raise ValueError("Differing Matrix Size")
|
||||||
target_height = len(matrix_a)
|
target_height = len(matrix_a)
|
||||||
target_width = len(matrix_b[0])idth])
|
target_width = len(matrix_b[0])
|
||||||
|
|
||||||
|
end_matrix : list[list[float]]= []
|
||||||
|
|
||||||
|
|
||||||
|
for height in range(target_height):
|
||||||
|
end_matrix.append([])
|
||||||
|
for width in range(target_width):
|
||||||
|
row = matrix_a[height]
|
||||||
|
column_ = []
|
||||||
|
for b in matrix_b:
|
||||||
|
column_.append(b[width])
|
||||||
result_quarter = 0
|
result_quarter = 0
|
||||||
for i in range(len(row)):
|
for i in range(len(row)):
|
||||||
result_quarter += row[i] * column_[i]
|
result_quarter += row[i] * column_[i]
|
||||||
@@ -52,16 +63,18 @@ def transpose(matrix:list[list[float]]) -> list[list[float]]:
|
|||||||
return transposed_matrix
|
return transposed_matrix
|
||||||
|
|
||||||
def rot_2d(angle:float) -> list[list[float]]:
|
def rot_2d(angle:float) -> list[list[float]]:
|
||||||
"""3rhb1tng :return: The Rotation Matrix
|
"""
|
||||||
|
Creates a Rotation Matrix out of the given angle
|
||||||
|
:param angle: The rotation in radians
|
||||||
|
:type angle: float
|
||||||
|
:return: The Rotation Matrix
|
||||||
:rtype: list[list[float]]
|
:rtype: list[list[float]]
|
||||||
"""
|
"""
|
||||||
sin = round(math.sin(angle), 4)
|
sin = round(math.sin(angle), 4)
|
||||||
cos = round(math.cos(angle), 4)
|
cos = round(math.cos(angle), 4)
|
||||||
return [[cos, -sin],
|
return [[cos, -sin],
|
||||||
[sin, cos]]sfbweb
|
[sin, cos]]
|
||||||
eg72g2748g#3
|
|
||||||
|
|
||||||
def leakCredit card info
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user