diff --git a/.gitignore b/.gitignore index ab2518d..19d97e0 100644 --- a/.gitignore +++ b/.gitignore @@ -149,5 +149,5 @@ com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties - -ibmq/.ibmq_key \ No newline at end of file +qwrapper/playground.py +ibmq/.ibmq_key diff --git a/qwrapper/hamiltonian.py b/qwrapper/hamiltonian.py index 679aaa3..6bc8d5c 100644 --- a/qwrapper/hamiltonian.py +++ b/qwrapper/hamiltonian.py @@ -1,13 +1,12 @@ import logging -import numpy - from qwrapper.obs import Hamiltonian from qwrapper.operator import ControllablePauli try: import cupy as np except ModuleNotFoundError: + print("cupy not found. numpy is used.") import numpy as np @@ -69,7 +68,7 @@ def to_matrix_hamiltonian(hamiltonian: Hamiltonian): else: result += (h + 0j) * o.to_matrix() count += 1 - return result + numpy.diag([hamiltonian._identity] * len(result)) + return result + np.diag([hamiltonian._identity] * len(result)) def compute_ground_state(hamiltonian: Hamiltonian): diff --git a/qwrapper/obs.py b/qwrapper/obs.py index 1c84b20..c916eb1 100644 --- a/qwrapper/obs.py +++ b/qwrapper/obs.py @@ -8,6 +8,7 @@ try: import cupy as np except ModuleNotFoundError: + print("cupy not found. numpy is used.") import numpy as np @@ -22,10 +23,10 @@ def build_operator_str(p_string): class Pauli: - X = np.matrix([[0, 1], [1, 0]]) - Y = np.matrix([[0, -1j], [1j, 0]]) - Z = np.matrix([[1, 0], [0, -1]]) - I = np.matrix([[1, 0], [0, 1]]) + X = np.array([[0, 1], [1, 0]]) + Y = np.array([[0, -1j], [1j, 0]]) + Z = np.array([[1, 0], [0, -1]]) + I = np.array([[1, 0], [0, 1]]) class Obs(abc.ABC): diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0812fbf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +qiskit>=0.30.0 +Qulacs>=0.3.0 +matplotlib>=3.0.0 +pylatexenc>=2.0 +qutip>=4.7.0 diff --git a/setup.py b/setup.py index ada7988..3ed0b4d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="qwrapper", - version="0.4.25", + version="0.4.26", author="kouhei nakaji", author_email="nakajijiji@gmail.com", description="You can receive the message 'Hello!!!'",