qflux 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of qflux might be problematic. Click here for more details.
- {qflux-0.0.2/src/qflux.egg-info → qflux-0.0.3}/PKG-INFO +1 -1
- {qflux-0.0.2 → qflux-0.0.3}/pyproject.toml +1 -1
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/VarQTE.py +35 -48
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/qubit_methods.py +1 -1
- {qflux-0.0.2 → qflux-0.0.3/src/qflux.egg-info}/PKG-INFO +1 -1
- {qflux-0.0.2 → qflux-0.0.3}/LICENSE +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/README.md +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/setup.cfg +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/dynamics_GQME.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/params.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/readwrite.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/tdvp.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/GQME/tt_tfd.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/classical_methods.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/custom_execute.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/hamiltonians.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/spin_dynamics_oo.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/spin_propagators.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/closed_systems/utils.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/dilation_circuit.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/numerical_methods.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/params.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/quantum_simulation.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/trans_basis.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/open_systems/walsh_gray_optimization.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/typing/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/typing/examples.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/utils/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/utils/io.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/utils/logging_config.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/qmad/__init__.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/qmad/ansatz.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/qmad/ansatzVect.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/qmad/effh.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux/variational_methods/qmad/solver.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux.egg-info/SOURCES.txt +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux.egg-info/dependency_links.txt +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux.egg-info/requires.txt +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/src/qflux.egg-info/top_level.txt +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/tests/test_import.py +0 -0
- {qflux-0.0.2 → qflux-0.0.3}/tests/test_sample.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qflux
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: qflux is a package for running quantum dynamics calculations on quantum devices.
|
|
5
5
|
Author-email: Brandon Allen <brandon.allen@yale.edu>, Delmar Cabral <delmar.azevedocabral@yale.edu>, Alexander Soudackov <alexander.soudackov@yale.edu>, Anton Morgunov <anton@ischemist.com>
|
|
6
6
|
License: MIT
|
|
@@ -3,15 +3,14 @@ import numpy.typing as npt
|
|
|
3
3
|
from typing import List, Optional, Tuple
|
|
4
4
|
|
|
5
5
|
from qiskit import QuantumCircuit
|
|
6
|
-
from
|
|
6
|
+
from qiskit_aer.primitives import EstimatorV2 as Estimator
|
|
7
7
|
from qiskit.quantum_info import SparsePauliOp
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
|
|
8
|
+
from qiskit_aer.noise import NoiseModel
|
|
9
|
+
from qiskit_ibm_runtime.fake_provider import FakeSherbrooke
|
|
11
10
|
|
|
12
11
|
# To change the ansatz, apply_param and measure_der must both be modified.
|
|
13
12
|
def apply_param(
|
|
14
|
-
params: npt.NDArray[np.
|
|
13
|
+
params: npt.NDArray[np.float64], i: int, qc: QuantumCircuit, N: int
|
|
15
14
|
) -> None:
|
|
16
15
|
"""Apply parameter i to the quantum circuit currently constructing the ansatz.
|
|
17
16
|
The ansatz must be built in a peicewise manner to allow for hadamard tests
|
|
@@ -24,7 +23,7 @@ def apply_param(
|
|
|
24
23
|
qc (QuantumCircuit): The qiskit ansatz quantum circuit currently being constructed.
|
|
25
24
|
N (int): Number of qubits
|
|
26
25
|
"""
|
|
27
|
-
qc.rx(params[i], i % N)
|
|
26
|
+
qc.rx(params[i], i % N)
|
|
28
27
|
if i % N == N - 1 and i != len(params) - 1:
|
|
29
28
|
for i in range(N - 1):
|
|
30
29
|
qc.cz(i, i + 1)
|
|
@@ -43,7 +42,7 @@ def measure_der(i: int, qc: QuantumCircuit, N: int) -> None:
|
|
|
43
42
|
qc.cx(N, i % N)
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
def A_Circuit(params: npt.NDArray[np.
|
|
45
|
+
def A_Circuit(params: npt.NDArray[np.float64], i: int, j: int, N: int) -> QuantumCircuit:
|
|
47
46
|
"""Constructs the qiskit quantum circuits used to measure each element of the A_ij matrix.
|
|
48
47
|
|
|
49
48
|
Args:
|
|
@@ -73,11 +72,11 @@ def A_Circuit(params: npt.NDArray[np.float_], i: int, j: int, N: int) -> Quantum
|
|
|
73
72
|
|
|
74
73
|
def Measure_A(
|
|
75
74
|
init_circ: QuantumCircuit,
|
|
76
|
-
params: npt.NDArray[np.
|
|
75
|
+
params: npt.NDArray[np.float64],
|
|
77
76
|
N: int,
|
|
78
77
|
shots: int = 2**10,
|
|
79
78
|
noisy: bool = False,
|
|
80
|
-
) -> npt.NDArray[np.
|
|
79
|
+
) -> npt.NDArray[np.float64]:
|
|
81
80
|
"""Create the A_ij matrix through measuring quantum circuits corresponding to each element.
|
|
82
81
|
|
|
83
82
|
Args:
|
|
@@ -104,23 +103,19 @@ def Measure_A(
|
|
|
104
103
|
coupling_map = device_backend.coupling_map
|
|
105
104
|
noise_model = NoiseModel.from_backend(device_backend)
|
|
106
105
|
basis_gates = noise_model.basis_gates
|
|
107
|
-
estimator = Estimator(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"noise_model": noise_model,
|
|
111
|
-
"coupling_map": coupling_map,
|
|
112
|
-
"basis_gates": basis_gates,
|
|
113
|
-
}
|
|
106
|
+
estimator = Estimator(options={
|
|
107
|
+
"backend_options":{"noise_model": noise_model},
|
|
108
|
+
"run_options":{"shots": shots}}
|
|
114
109
|
)
|
|
115
110
|
else:
|
|
116
|
-
estimator = Estimator(options={"shots": shots})
|
|
117
|
-
result = estimator.run(qc, observable).result()
|
|
118
|
-
A[i][i + j] = result
|
|
111
|
+
estimator = Estimator(options={"run_options":{"shots": shots}})
|
|
112
|
+
result = estimator.run([(qc, observable)]).result()
|
|
113
|
+
A[i][i + j] = result[0].data.evs
|
|
119
114
|
return np.array(A)
|
|
120
115
|
|
|
121
116
|
|
|
122
117
|
def C_Circuit(
|
|
123
|
-
params: npt.NDArray[np.
|
|
118
|
+
params: npt.NDArray[np.float64],
|
|
124
119
|
i: int,
|
|
125
120
|
pauli_string: str,
|
|
126
121
|
N: int,
|
|
@@ -162,13 +157,13 @@ def C_Circuit(
|
|
|
162
157
|
|
|
163
158
|
def Measure_C(
|
|
164
159
|
init_circ: QuantumCircuit,
|
|
165
|
-
params: npt.NDArray[np.
|
|
160
|
+
params: npt.NDArray[np.float64],
|
|
166
161
|
H: SparsePauliOp,
|
|
167
162
|
N: int,
|
|
168
163
|
shots: int = 2**10,
|
|
169
164
|
evolution_type: str = "real",
|
|
170
165
|
noisy: bool = False,
|
|
171
|
-
) -> npt.NDArray[np.
|
|
166
|
+
) -> npt.NDArray[np.float64]:
|
|
172
167
|
"""Create the C_i vector through measuring quantum circuits corresponding to each element.
|
|
173
168
|
|
|
174
169
|
Args:
|
|
@@ -199,19 +194,15 @@ def Measure_C(
|
|
|
199
194
|
coupling_map = device_backend.coupling_map
|
|
200
195
|
noise_model = NoiseModel.from_backend(device_backend)
|
|
201
196
|
basis_gates = noise_model.basis_gates
|
|
202
|
-
estimator = Estimator(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"coupling_map": coupling_map,
|
|
207
|
-
"basis_gates": basis_gates,
|
|
208
|
-
}
|
|
209
|
-
)
|
|
197
|
+
estimator = Estimator(options={
|
|
198
|
+
"backend_options":{"noise_model": noise_model},
|
|
199
|
+
"run_options":{"shots": shots}}
|
|
200
|
+
)
|
|
210
201
|
else:
|
|
211
|
-
estimator = Estimator(options={"shots": shots})
|
|
212
|
-
result = estimator.run(qc, observable).result()
|
|
202
|
+
estimator = Estimator(options={"run_options":{"shots": shots}})
|
|
203
|
+
result = estimator.run([(qc, observable)]).result()
|
|
213
204
|
|
|
214
|
-
C[i] -= 1 / 2 * H.coeffs[pauli_string].real * result
|
|
205
|
+
C[i] -= 1 / 2 * H.coeffs[pauli_string].real * result[0].data.evs
|
|
215
206
|
return np.array(C)
|
|
216
207
|
|
|
217
208
|
|
|
@@ -233,7 +224,7 @@ def pauli_measure(qc: QuantumCircuit, pauli_string: str) -> None:
|
|
|
233
224
|
|
|
234
225
|
|
|
235
226
|
def Construct_Ansatz(
|
|
236
|
-
init_circ: QuantumCircuit, params: npt.NDArray[np.
|
|
227
|
+
init_circ: QuantumCircuit, params: npt.NDArray[np.float64], N: int
|
|
237
228
|
) -> QuantumCircuit:
|
|
238
229
|
"""Construct the full ansatz for use in measuring observables.
|
|
239
230
|
|
|
@@ -258,7 +249,7 @@ def Construct_Ansatz(
|
|
|
258
249
|
|
|
259
250
|
def ansatz_energy(
|
|
260
251
|
init_circ: QuantumCircuit,
|
|
261
|
-
params: npt.NDArray[np.
|
|
252
|
+
params: npt.NDArray[np.float64],
|
|
262
253
|
H: SparsePauliOp,
|
|
263
254
|
shots: int = 2**14,
|
|
264
255
|
noisy: bool = False,
|
|
@@ -282,19 +273,15 @@ def ansatz_energy(
|
|
|
282
273
|
coupling_map = device_backend.coupling_map
|
|
283
274
|
noise_model = NoiseModel.from_backend(device_backend)
|
|
284
275
|
basis_gates = noise_model.basis_gates
|
|
285
|
-
estimator = Estimator(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
"coupling_map": coupling_map,
|
|
290
|
-
"basis_gates": basis_gates,
|
|
291
|
-
}
|
|
292
|
-
)
|
|
276
|
+
estimator = Estimator(options={
|
|
277
|
+
"backend_options":{"noise_model": noise_model},
|
|
278
|
+
"run_options":{"shots": shots}}
|
|
279
|
+
)
|
|
293
280
|
else:
|
|
294
|
-
estimator = Estimator(options={"shots": shots})
|
|
281
|
+
estimator = Estimator(options={"run_options":{"shots": shots}})
|
|
295
282
|
qc = Construct_Ansatz(init_circ, params, N)
|
|
296
|
-
result = estimator.run(qc, H).result()
|
|
297
|
-
return result
|
|
283
|
+
result = estimator.run([(qc, H)]).result()
|
|
284
|
+
return result[0].data.evs, result[0].data.stds
|
|
298
285
|
|
|
299
286
|
|
|
300
287
|
def VarQRTE(
|
|
@@ -305,7 +292,7 @@ def VarQRTE(
|
|
|
305
292
|
init_circ: Optional[QuantumCircuit] = None,
|
|
306
293
|
shots: int = 2**10,
|
|
307
294
|
noisy: bool = False,
|
|
308
|
-
) -> List[npt.NDArray[np.
|
|
295
|
+
) -> List[npt.NDArray[np.float64]]:
|
|
309
296
|
"""The Variational Quantum Real Time Evolution (VarQRTE) algorithm. This uses quantum circuits to measure
|
|
310
297
|
the elements of two objects, the A_ij matrix and the C_i vector.
|
|
311
298
|
|
|
@@ -368,7 +355,7 @@ def VarQITE(
|
|
|
368
355
|
init_circ: Optional[QuantumCircuit] = None,
|
|
369
356
|
shots: int = 2**10,
|
|
370
357
|
noisy: bool = False,
|
|
371
|
-
) -> List[npt.NDArray[np.
|
|
358
|
+
) -> List[npt.NDArray[np.float64]]:
|
|
372
359
|
"""The Variational Quantum Imaginary Time Evolution (VarQITE) algorithm. This uses quantum circuits to measure
|
|
373
360
|
the elements of two objects, the A_ij matrix and the C_i vector.
|
|
374
361
|
|
|
@@ -220,7 +220,7 @@ class QubitDynamicsCS(DynamicsCS):
|
|
|
220
220
|
|
|
221
221
|
|
|
222
222
|
def propagate_qmatvec(self, backend=None, n_shots: int = 1024, hamiltonian_matrix=None, initial_state=None):
|
|
223
|
-
"""
|
|
223
|
+
r"""
|
|
224
224
|
Function to propagate dynamics object with the qubit matvec method.
|
|
225
225
|
|
|
226
226
|
Args:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qflux
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: qflux is a package for running quantum dynamics calculations on quantum devices.
|
|
5
5
|
Author-email: Brandon Allen <brandon.allen@yale.edu>, Delmar Cabral <delmar.azevedocabral@yale.edu>, Alexander Soudackov <alexander.soudackov@yale.edu>, Anton Morgunov <anton@ischemist.com>
|
|
6
6
|
License: MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|