ínit
This commit is contained in:
commit
4ade79c4fc
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
10
.idea/MatrixMania.iml
generated
Normal file
10
.idea/MatrixMania.iml
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.12 (MatrixMania)" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/MatrixMania.iml" filepath="$PROJECT_DIR$/.idea/MatrixMania.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
43
compute.py
Normal file
43
compute.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
from typing import List
|
||||||
|
import math
|
||||||
|
|
||||||
|
Matrix = List[List[float]]
|
||||||
|
|
||||||
|
def matmul(matrix_1: Matrix, Matrix_2: Matrix) -> Matrix: #alles klein
|
||||||
|
HeightA = len(matrix_1)
|
||||||
|
HeightB = len(Matrix_2)
|
||||||
|
if HeightA == 0 or HeightB == 0:
|
||||||
|
raise ValueError("Matrizen dürfen nicht leer sein")
|
||||||
|
WidthA = len(matrix_1[0])
|
||||||
|
WidthB = len(Matrix_2[0])
|
||||||
|
if WidthA != HeightB:
|
||||||
|
raise ValueError("Multiplikation der Matrizen nicht zulässig (Spalten A != Zeilen B)")
|
||||||
|
Matrix_3 = [[0.0 for _ in range(WidthB)] for _ in range(HeightA)]
|
||||||
|
for i in range(HeightA):
|
||||||
|
for j in range(WidthB):
|
||||||
|
for k in range(WidthA):
|
||||||
|
Matrix_3[i][j] += matrix_1[i][k] * Matrix_2[k][j]
|
||||||
|
return Matrix_3
|
||||||
|
|
||||||
|
def transpose(matrix: Matrix) -> Matrix:
|
||||||
|
if not matrix:
|
||||||
|
raise ValueError("Matrix darf nicht leer sein")
|
||||||
|
rows = len(matrix)
|
||||||
|
cols = len(matrix[0])
|
||||||
|
if not all(len(row) == cols for row in matrix):
|
||||||
|
raise ValueError("Matrix hat ungleichmäßige Zeilenlängen")
|
||||||
|
transposed_matrix = [[0.0 for _ in range(rows)] for _ in range(cols)]
|
||||||
|
for i in range(rows):
|
||||||
|
for j in range(cols):
|
||||||
|
transposed_matrix[j][i] = matrix[i][j]
|
||||||
|
return transposed_matrix
|
||||||
|
|
||||||
|
def rot_2D(angle_degrees: float) -> Matrix:
|
||||||
|
angle_radians = math.radians(angle_degrees)
|
||||||
|
cos_theta = math.cos(angle_radians)
|
||||||
|
sin_theta = math.sin(angle_radians)
|
||||||
|
rotation_matrix = [
|
||||||
|
[cos_theta, -sin_theta],
|
||||||
|
[sin_theta, cos_theta]
|
||||||
|
]
|
||||||
|
return rotation_matrix
|
||||||
Loading…
x
Reference in New Issue
Block a user