emu-mps 2.4.4__py3-none-any.whl → 2.5.1__py3-none-any.whl
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.
- emu_mps/__init__.py +1 -1
- emu_mps/mps.py +3 -2
- emu_mps/mps_backend_impl.py +5 -1
- emu_mps/solver_utils.py +9 -4
- {emu_mps-2.4.4.dist-info → emu_mps-2.5.1.dist-info}/METADATA +2 -2
- {emu_mps-2.4.4.dist-info → emu_mps-2.5.1.dist-info}/RECORD +7 -7
- {emu_mps-2.4.4.dist-info → emu_mps-2.5.1.dist-info}/WHEEL +1 -1
emu_mps/__init__.py
CHANGED
emu_mps/mps.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import math
|
|
3
2
|
from collections import Counter
|
|
4
3
|
from typing import List, Optional, Sequence, TypeVar, Mapping
|
|
5
4
|
import logging
|
|
@@ -479,8 +478,10 @@ class MPS(State[complex, torch.Tensor]):
|
|
|
479
478
|
else:
|
|
480
479
|
factors.append(basis_0)
|
|
481
480
|
accum_mps += amplitude * MPS(factors, eigenstates=eigenstates)
|
|
481
|
+
|
|
482
482
|
norm = accum_mps.norm()
|
|
483
|
-
|
|
483
|
+
# This must duplicate the tolerance in pulsers State._to_abstract_repr
|
|
484
|
+
if abs(norm**4 - 1.0) > 1e-12:
|
|
484
485
|
logging.getLogger("emulators").warning(
|
|
485
486
|
"\nThe state is not normalized, normalizing it for you."
|
|
486
487
|
)
|
emu_mps/mps_backend_impl.py
CHANGED
|
@@ -119,6 +119,7 @@ class MPSBackendImpl:
|
|
|
119
119
|
self.phi = pulser_data.phi
|
|
120
120
|
self.timestep_count: int = self.omega.shape[0]
|
|
121
121
|
self.has_lindblad_noise = pulser_data.has_lindblad_noise
|
|
122
|
+
self.eigenstates = pulser_data.eigenstates
|
|
122
123
|
self.dim = pulser_data.dim
|
|
123
124
|
self.lindblad_noise = torch.zeros(self.dim, self.dim, dtype=dtype)
|
|
124
125
|
self.qubit_permutation = (
|
|
@@ -220,6 +221,7 @@ class MPSBackendImpl:
|
|
|
220
221
|
precision=self.config.precision,
|
|
221
222
|
max_bond_dim=self.config.max_bond_dim,
|
|
222
223
|
num_gpus_to_use=self.resolved_num_gpus,
|
|
224
|
+
eigenstates=self.eigenstates,
|
|
223
225
|
)
|
|
224
226
|
return
|
|
225
227
|
|
|
@@ -268,6 +270,7 @@ class MPSBackendImpl:
|
|
|
268
270
|
),
|
|
269
271
|
hamiltonian_type=self.hamiltonian_type,
|
|
270
272
|
num_gpus_to_use=self.resolved_num_gpus,
|
|
273
|
+
dim=self.dim,
|
|
271
274
|
)
|
|
272
275
|
|
|
273
276
|
update_H(
|
|
@@ -342,6 +345,7 @@ class MPSBackendImpl:
|
|
|
342
345
|
config=self.config,
|
|
343
346
|
orth_center_right=orth_center_right,
|
|
344
347
|
is_hermitian=not self.has_lindblad_noise,
|
|
348
|
+
dim=self.dim,
|
|
345
349
|
)
|
|
346
350
|
|
|
347
351
|
self.state.orthogonality_center = r if orth_center_right else l
|
|
@@ -616,7 +620,7 @@ class NoisyMPSBackendImpl(MPSBackendImpl):
|
|
|
616
620
|
# The below is used for batch computation of noise collapse weights.
|
|
617
621
|
self.aggregated_lindblad_ops = stacked.conj().transpose(1, 2) @ stacked
|
|
618
622
|
|
|
619
|
-
self.lindblad_noise = compute_noise_from_lindbladians(self.lindblad_ops)
|
|
623
|
+
self.lindblad_noise = compute_noise_from_lindbladians(self.lindblad_ops, self.dim)
|
|
620
624
|
|
|
621
625
|
def set_jump_threshold(self, bound: float) -> None:
|
|
622
626
|
self.jump_threshold = random.uniform(0.0, bound)
|
emu_mps/solver_utils.py
CHANGED
|
@@ -14,6 +14,7 @@ def make_op(
|
|
|
14
14
|
state_factors: Sequence[torch.Tensor],
|
|
15
15
|
baths: tuple[torch.Tensor, torch.Tensor],
|
|
16
16
|
ham_factors: Sequence[torch.Tensor],
|
|
17
|
+
dim: int = 2,
|
|
17
18
|
) -> tuple[torch.Tensor, torch.device, Callable[[torch.Tensor], torch.Tensor]]:
|
|
18
19
|
assert len(state_factors) == 2
|
|
19
20
|
assert len(baths) == 2
|
|
@@ -35,7 +36,7 @@ def make_op(
|
|
|
35
36
|
|
|
36
37
|
combined_state_factors = torch.tensordot(
|
|
37
38
|
left_state_factor, right_state_factor, dims=1
|
|
38
|
-
).reshape(left_bond_dim,
|
|
39
|
+
).reshape(left_bond_dim, dim**2, right_bond_dim)
|
|
39
40
|
|
|
40
41
|
deallocate_tensor(left_state_factor)
|
|
41
42
|
deallocate_tensor(right_state_factor)
|
|
@@ -48,7 +49,7 @@ def make_op(
|
|
|
48
49
|
torch.tensordot(left_ham_factor, right_ham_factor, dims=1)
|
|
49
50
|
.transpose(2, 3)
|
|
50
51
|
.contiguous()
|
|
51
|
-
.view(left_ham_factor.shape[0],
|
|
52
|
+
.view(left_ham_factor.shape[0], dim**2, dim**2, -1)
|
|
52
53
|
)
|
|
53
54
|
|
|
54
55
|
def op(x: torch.Tensor) -> torch.Tensor:
|
|
@@ -151,6 +152,7 @@ def evolve_pair(
|
|
|
151
152
|
orth_center_right: bool,
|
|
152
153
|
is_hermitian: bool,
|
|
153
154
|
config: MPSConfig,
|
|
155
|
+
dim: int = 2,
|
|
154
156
|
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
155
157
|
"""
|
|
156
158
|
Time evolution of a pair of tensors of a tensor train using baths and truncated SVD.
|
|
@@ -165,6 +167,7 @@ def evolve_pair(
|
|
|
165
167
|
state_factors=state_factors,
|
|
166
168
|
baths=baths,
|
|
167
169
|
ham_factors=ham_factors,
|
|
170
|
+
dim=dim,
|
|
168
171
|
)
|
|
169
172
|
left_bond_dim = combined_state_factors.shape[0]
|
|
170
173
|
right_bond_dim = combined_state_factors.shape[-1]
|
|
@@ -176,7 +179,7 @@ def evolve_pair(
|
|
|
176
179
|
norm_tolerance=config.precision * config.extra_krylov_tolerance,
|
|
177
180
|
max_krylov_dim=config.max_krylov_dim,
|
|
178
181
|
is_hermitian=is_hermitian,
|
|
179
|
-
).view(left_bond_dim *
|
|
182
|
+
).view(left_bond_dim * dim, dim * right_bond_dim)
|
|
180
183
|
|
|
181
184
|
l, r = split_matrix(
|
|
182
185
|
evol,
|
|
@@ -186,7 +189,9 @@ def evolve_pair(
|
|
|
186
189
|
preserve_norm=not is_hermitian, # only relevant for computing jump times
|
|
187
190
|
)
|
|
188
191
|
|
|
189
|
-
return l.view(left_bond_dim,
|
|
192
|
+
return l.view(left_bond_dim, dim, -1), r.view(-1, dim, right_bond_dim).to(
|
|
193
|
+
right_device
|
|
194
|
+
)
|
|
190
195
|
|
|
191
196
|
|
|
192
197
|
def evolve_single(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: emu-mps
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.1
|
|
4
4
|
Summary: Pasqal MPS based pulse emulator built on PyTorch
|
|
5
5
|
Project-URL: Documentation, https://pasqal-io.github.io/emulators/
|
|
6
6
|
Project-URL: Repository, https://github.com/pasqal-io/emulators
|
|
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
25
25
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
26
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
27
27
|
Requires-Python: >=3.10
|
|
28
|
-
Requires-Dist: emu-base==2.
|
|
28
|
+
Requires-Dist: emu-base==2.5.1
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
31
31
|
<div align="center">
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
emu_mps/__init__.py,sha256=
|
|
1
|
+
emu_mps/__init__.py,sha256=k9ufwCRkS0Y_-jMXmLg8XJVg7ZjG4Y4hEWTdyfA-Qws,708
|
|
2
2
|
emu_mps/algebra.py,sha256=VZ5uaX5PYWGqDCpRKKr819BLMMtT0pKDxc2HrlLCdgU,5423
|
|
3
3
|
emu_mps/custom_callback_implementations.py,sha256=WeczmO6qkvBIipvXLqX45i3D7M4ovOrepusIGs6d2Ts,2420
|
|
4
4
|
emu_mps/hamiltonian.py,sha256=OM0bPNZV7J5Egk6aTUwt4GaWqiUOP68ujZBTuqlBY1k,16289
|
|
5
5
|
emu_mps/mpo.py,sha256=WmGDGkCMhlODmydd0b09YcSRlsk6Bg5xYQ4rXSNJvnY,9703
|
|
6
|
-
emu_mps/mps.py,sha256=
|
|
6
|
+
emu_mps/mps.py,sha256=aIWbd3s4c2lqhzR1IukxOAmRK7kfUFBPHkOOCS3dcPM,21747
|
|
7
7
|
emu_mps/mps_backend.py,sha256=dXcW5Fa2AAL_WlHUgr30WS2l3qiDJgBVebiVpyYWpPM,2064
|
|
8
|
-
emu_mps/mps_backend_impl.py,sha256=
|
|
8
|
+
emu_mps/mps_backend_impl.py,sha256=WyB1PpC61rzrnr_c3epVZOhDtXLOdhQLsMgUtZQWCYg,30851
|
|
9
9
|
emu_mps/mps_config.py,sha256=btlygf6VDFna9TQus-zOmUqB6pfe_aoQmNoivfvxABk,8251
|
|
10
10
|
emu_mps/observables.py,sha256=4C_ewkd3YkJP0xghTrGUTgXUGvJRCQcetb8cU0SjMl0,1900
|
|
11
11
|
emu_mps/solver.py,sha256=M9xkHhlEouTBvoPw2UYVu6kij7CO4Z1FXw_SiGFtdgo,85
|
|
12
|
-
emu_mps/solver_utils.py,sha256=
|
|
12
|
+
emu_mps/solver_utils.py,sha256=Q1SY8E3Kipe_RfKE8lAMRfD4mSG2VkkkPmk-fU7eAgY,8852
|
|
13
13
|
emu_mps/utils.py,sha256=rL75H55hB5lDMjy8a_O2PpJq51iZKjSx91X4euxB3mY,7293
|
|
14
14
|
emu_mps/optimatrix/__init__.py,sha256=fBXQ7-rgDro4hcaBijCGhx3J69W96qcw5_3mWc7tND4,364
|
|
15
15
|
emu_mps/optimatrix/optimiser.py,sha256=k9suYmKLKlaZ7ozFuIqvXHyCBoCtGgkX1mpen9GOdOo,6977
|
|
16
16
|
emu_mps/optimatrix/permutations.py,sha256=9DDMZtrGGZ01b9F3GkzHR3paX4qNtZiPoI7Z_Kia3Lc,3727
|
|
17
|
-
emu_mps-2.
|
|
18
|
-
emu_mps-2.
|
|
19
|
-
emu_mps-2.
|
|
17
|
+
emu_mps-2.5.1.dist-info/METADATA,sha256=YxHxr2OczYsHmsBXmP0k8SUuTlpx96W2fj0jlqJIBZE,3587
|
|
18
|
+
emu_mps-2.5.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
19
|
+
emu_mps-2.5.1.dist-info/RECORD,,
|