fixe to_list()
This commit is contained in:
parent
77ee550046
commit
2bc6d27999
2 changed files with 22 additions and 4 deletions
18
Matrix_test.py
Normal file
18
Matrix_test.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
from QElephant.Matrix import *
|
||||||
|
from pytest import *
|
||||||
|
|
||||||
|
m = Matrix([[1, 2, 3], [4, 5, 6]])
|
||||||
|
|
||||||
|
assert m._Matrix__m == [[1, 2, 3], [4, 5, 6]]
|
||||||
|
assert m._Matrix__size == (2, 3)
|
||||||
|
m_ = m * Matrix([[1, 1], [0, 0]])
|
||||||
|
assert m_._Matrix__m == [
|
||||||
|
[1, 1, 2, 2, 3, 3],
|
||||||
|
[0, 0, 0, 0, 0, 0],
|
||||||
|
[4, 4, 5, 5, 6, 6],
|
||||||
|
[0, 0, 0, 0, 0, 0],
|
||||||
|
]
|
||||||
|
m_ = m._Matrix__apply([1, 2, 3])
|
||||||
|
assert m_ == [14, 32]
|
||||||
|
assert str(m) == "[[1, 2, 3], [4, 5, 6]]"
|
||||||
|
assert m.to_list() == [[1, 2, 3], [4, 5, 6]]
|
||||||
|
|
@ -32,13 +32,13 @@ Matrix(l: list[list[complexe]])
|
||||||
|
|
||||||
returns a string representation of the matrix
|
returns a string representation of the matrix
|
||||||
|
|
||||||
|
- ```to_list() -> list[list[complex]]```
|
||||||
### Staticmethods
|
|
||||||
|
|
||||||
- ```to_list(matrix: Matrix) -> list[list[complex]]```
|
|
||||||
|
|
||||||
returns the a list representing the given Matrix.
|
returns the a list representing the given Matrix.
|
||||||
|
|
||||||
|
|
||||||
|
### Staticmethods
|
||||||
|
|
||||||
- ```I() -> Matrix```
|
- ```I() -> Matrix```
|
||||||
|
|
||||||
returns the matrix
|
returns the matrix
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue