update Mubit.md and QuBit.py

This commit is contained in:
Didictateur 2023-10-24 16:32:23 +02:00
parent 363cd99e9a
commit 72af91f091
2 changed files with 6 additions and 6 deletions

View file

@ -71,11 +71,11 @@ class MuBit:
raise TypeError(f"MuBit indices must be integers, not {type(item)}") raise TypeError(f"MuBit indices must be integers, not {type(item)}")
if item > self.__n: if item > self.__n:
raise IndexError("MuBit index out of range") raise IndexError("MuBit index out of range")
item = item%self.__n item = item%self.__n
return IQuBit(item, self) return IQuBit(item, self)
def __apply(self, i: int, matrix: Matrix) -> None: def __apply(self, matrix: Matrix, i: int) -> None:
if type(i) is not int: if type(i) is not int:
raise TypeError(f"MuBit indices must be integers, not {type(i)}") raise TypeError(f"MuBit indices must be integers, not {type(i)}")
if i > self.__n: if i > self.__n:

View file

@ -40,13 +40,13 @@ MuBit(n: int)
creates an intricated QuBit corresponding to the item-th QuBit. creates an intricated QuBit corresponding to the item-th QuBit.
- ```__apply(m: Matrix) -> None``` - ```__apply(matrix: Matrix, i: int) -> None```
takes a Matrix and modifies the QuBits according the matrix. takes a Matrix of size (2, 2) and modifies the i-th QuBits according the matrix.
- ```__mapply(m: Matrix, i: int) -> None``` - ```__mapply(matrix: Matrix, i: int) -> None```
takes a Matrix and modifies the i-th QuBit according the matrix. takes a Matrix aof size (4, 4) and modifies the i-th QuBit and le next one together according the matrix.
- ```__getProbs(i: int) -> float``` - ```__getProbs(i: int) -> float```