true version
This commit is contained in:
parent
a32d3fd38c
commit
447d26bcba
6 changed files with 22 additions and 48 deletions
21
LICENSE
21
LICENSE
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import math
|
||||
import random as rd
|
||||
|
||||
from Matrix import *
|
||||
from QElephant.Matrix import *
|
||||
|
||||
I = complex(0, 1)
|
||||
|
||||
|
|
@ -118,61 +118,61 @@ class IQuBit:
|
|||
|
||||
def H(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.H())
|
||||
q._QuBit__apply(Matrix.H())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.H())
|
||||
|
||||
def X(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.X())
|
||||
q._QuBit__apply(Matrix.X())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.X())
|
||||
|
||||
def Y(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.Y())
|
||||
q._QuBit__apply(Matrix.Y())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.Y())
|
||||
|
||||
def Z(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.Z())
|
||||
q._QuBit__apply(Matrix.Z())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.Z())
|
||||
|
||||
def S(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.S())
|
||||
q._QuBit__apply(Matrix.S())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.S())
|
||||
|
||||
def T(q: (QuBit | IQuBit)) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.T())
|
||||
q._QuBit__apply(Matrix.T())
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.T())
|
||||
|
||||
def Rx(q: (QuBit | IQuBit), phi: float) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.Rx(phi))
|
||||
q._QuBit__apply(Matrix.Rx(phi))
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.Rx(phi))
|
||||
|
||||
def Ry(q: (QuBit | IQuBit), phi: float) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.Ry(phi))
|
||||
q._QuBit__apply(Matrix.Ry(phi))
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.Ry(phi))
|
||||
|
||||
def Rz(q: (QuBit | IQuBit), phi: float) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.Rz(phi))
|
||||
q._QuBit__apply(Matrix.Rz(phi))
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.Rz(phi))
|
||||
|
||||
def R1(q: (QuBit | IQuBit), phi: float) -> None:
|
||||
if type(q) == QuBit:
|
||||
q._Qubit__apply(Matrix.R1(phi))
|
||||
q._QuBit__apply(Matrix.R1(phi))
|
||||
elif type(q) == IQuBit:
|
||||
q._IQuBit__apply(Matrix.R1(phi))
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
require = ["hatchling", "math", "random"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
name = "QElephant"
|
||||
version = "0.0.1"
|
||||
authors = [
|
||||
{ name = "Didictateur"}
|
||||
]
|
||||
description = ""
|
||||
readme = "README.me"
|
||||
requires-python = ">= 3.0"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
11
setup.py
Normal file
11
setup.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="QElephant",
|
||||
version="1.0.2",
|
||||
description="",
|
||||
author="Didictateur",
|
||||
author_email="decosse.adrien@gmail.com",
|
||||
packages=["QElephant"],
|
||||
install_requires=[],
|
||||
)
|
||||
Loading…
Reference in a new issue