add method Matrix
This commit is contained in:
parent
e9b1cfd056
commit
fb591ce191
2 changed files with 11 additions and 0 deletions
|
|
@ -43,6 +43,13 @@ class Matrix:
|
|||
def __str__(self) -> str:
|
||||
return str(self.__m)
|
||||
|
||||
@staticmethod
|
||||
def to_list(matrix: "Matrix") -> list[list[complex]]:
|
||||
if type(matrix) is not Matrix:
|
||||
raise ValueError(f"cannot multiply Matrix with {type(matrix)}")
|
||||
|
||||
return matrix._Matrix__m.copy()
|
||||
|
||||
@staticmethod
|
||||
def I() -> "Matrix":
|
||||
return Matrix([
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ Matrix(l: list[list[complexe]])
|
|||
|
||||
### Staticmethods
|
||||
|
||||
- ```to_list(matrix: Matrix) -> list[list[complex]]```
|
||||
|
||||
returns the a list representing the given Matrix.
|
||||
|
||||
- ```I() -> Matrix```
|
||||
|
||||
returns the matrix
|
||||
|
|
|
|||
Loading…
Reference in a new issue