Apollo läuft!
This commit is contained in:
1 parent
ddaceeaffe
commit
93ee30229d
2 files changed
+54
-14
No files matched your search
+1
-14
@@ -53,20 +53,12 @@ def matmul(left: Matrix, right: Matrix) -> list[list[float]]:
|
||||
result.append(row)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
# Helper to validate a matrix is non‑empty and rectangular.
|
||||
def rot_2D(theta: float) -> list[list[float]]:
|
||||
"""Return the 2‑D rotation matrix for a given angle.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
theta
|
||||
Rotation angle in radians.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list[list[float]]
|
||||
2×2 rotation matrix ``[[cosθ, -sinθ], [sinθ, cosθ]]``.
|
||||
"""
|
||||
@@ -76,12 +68,10 @@ def rot_2D(theta: float) -> list[list[float]]:
|
||||
|
||||
def _validate(matrix: Matrix, name: str) -> None:
|
||||
"""Check that *matrix* is a non‑empty, rectangular 2D sequence.
|
||||
|
||||
Validation rules:
|
||||
* The outer sequence must contain at least one row.
|
||||
* Every row must have the same number of columns.
|
||||
* No empty rows are allowed.
|
||||
|
||||
Raises:
|
||||
ValueError: If the matrix is empty, has zero columns, or is ragged.
|
||||
"""
|
||||
@@ -98,10 +88,7 @@ def _validate(matrix: Matrix, name: str) -> None:
|
||||
)
|
||||
|
||||
def transpose(matrix: Matrix) -> list[list[float]]:
|
||||
"""Transponiere die gegebene Matrix.
|
||||
|
||||
Alle Zeilen werden zu Spalten und alle Spalten zu Zeilen.
|
||||
|
||||
"""Transponieren: Alle Zeilen werden zu Spalten und alle Spalten zu Zeilen.
|
||||
Parameters
|
||||
matrix
|
||||
Matrix in Form ``Sequence[Sequence[float]]``.
|
||||
|
||||
Reference in new issue
Block a user