first commit
This commit is contained in:
commit
82571c1c3b
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.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.13 (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>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal 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>
|
||||||
89
compute.py
Normal file
89
compute.py
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
def matmul(mA:list[list[int]], mB:list[list[int]]) -> list[list[int]]:
|
||||||
|
"""
|
||||||
|
Matrixmultiplication of matrizes with ints -> returns matrix as result
|
||||||
|
:param mA:
|
||||||
|
:param mB:
|
||||||
|
:return:
|
||||||
|
:raises ValueError: if Mismatch of Width first matrix and Height of second matrix
|
||||||
|
"""
|
||||||
|
|
||||||
|
HeightA = len(mA) ## zählt anzahl der listen in der äußeren Liste
|
||||||
|
WidthA = len(mA[0]) ## zählt anzahl der elemente der nullten Liste
|
||||||
|
HeightB = len(mB)
|
||||||
|
WidthB = len(mB[0])
|
||||||
|
|
||||||
|
if WidthA != HeightB:
|
||||||
|
raise ValueError('Mismatch of Width of A and Height of B')
|
||||||
|
|
||||||
|
result = [[0 for _ in range(WidthB)] for _ in range(HeightA)]
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(HeightA):
|
||||||
|
for j in range(WidthB):
|
||||||
|
for k in range(WidthA):
|
||||||
|
result[i][j] += mA[i][k] * mB[k][j]
|
||||||
|
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
##=================================================================================
|
||||||
|
def transpose(matrix:list[list[int]]) -> list[list[int]]:
|
||||||
|
"""
|
||||||
|
Transposes given matrix
|
||||||
|
:param matrix:
|
||||||
|
:return:
|
||||||
|
:raises: ValueError if Inconsistent number of columns OR matrix is empty
|
||||||
|
"""
|
||||||
|
if not matrix:
|
||||||
|
raise ValueError('matrix is empty')
|
||||||
|
|
||||||
|
height_old = len(matrix)
|
||||||
|
width_old = len(matrix[0])
|
||||||
|
|
||||||
|
for i in range(len(matrix) - 1):
|
||||||
|
if len(matrix[i]) != len(matrix[i + 1]):
|
||||||
|
raise ValueError('Inconsistent number of columns')
|
||||||
|
|
||||||
|
result = [[0 for _ in range(height_old)] for _ in range(width_old)]
|
||||||
|
height_new = len(result)
|
||||||
|
width_new = len(result[0])
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(height_new):
|
||||||
|
for j in range(width_new):
|
||||||
|
result[i][j] = matrix[j][i]
|
||||||
|
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
##=================================================================================
|
||||||
|
def rot_2D(bogenmaß: float) -> list[list[float]]: ##auf Bogenmaß
|
||||||
|
|
||||||
|
return [
|
||||||
|
[math.cos(bogenmaß), -math.sin(bogenmaß)],
|
||||||
|
[math.sin(bogenmaß), math.cos(bogenmaß)]
|
||||||
|
]
|
||||||
|
##rota matrix ist: aus Aufgabe ggben
|
||||||
|
## cos -sin
|
||||||
|
## sin cos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user