emu-base 2.0.3__py3-none-any.whl → 2.1.0__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_base/__init__.py CHANGED
@@ -16,4 +16,4 @@ __all__ = [
16
16
  "DEVICE_COUNT",
17
17
  ]
18
18
 
19
- __version__ = "2.0.3"
19
+ __version__ = "2.1.0"
@@ -45,3 +45,16 @@ def get_lindblad_operators(
45
45
  ]
46
46
 
47
47
  raise ValueError(f"Unknown noise type: {noise_type}")
48
+
49
+
50
+ def compute_noise_from_lindbladians(lindbladians: list[torch.Tensor]) -> torch.Tensor:
51
+ """
52
+ Compute the single-qubit Hamiltonian noise term -0.5i∑L†L from all the given lindbladians.
53
+ """
54
+ assert all(
55
+ lindbladian.shape == (2, 2) for lindbladian in lindbladians
56
+ ), "Only single-qubit lindblad operators are supported"
57
+
58
+ zero = torch.zeros(2, 2, dtype=torch.complex128)
59
+
60
+ return -0.5j * sum((L.mH @ L for L in lindbladians), start=zero)
@@ -73,7 +73,9 @@ def lanczos(
73
73
  """
74
74
  converged = False
75
75
  lanczos_vectors = [v / v.norm()]
76
- T = torch.zeros(max_krylov_dim + 2, max_krylov_dim + 2, dtype=v.dtype)
76
+ T = torch.zeros(
77
+ max_krylov_dim + 2, max_krylov_dim + 2, dtype=v.dtype, device=v.device
78
+ )
77
79
 
78
80
  for j in range(max_krylov_dim):
79
81
  w = op(lanczos_vectors[-1])
@@ -3,12 +3,12 @@ from typing import Tuple, Sequence
3
3
  import torch
4
4
  import math
5
5
  from pulser.noise_model import NoiseModel
6
- from pulser.register.base_register import BaseRegister
6
+ from pulser.register.base_register import BaseRegister, QubitId
7
7
  from enum import Enum
8
8
 
9
9
  from pulser.backend.config import EmulationConfig
10
10
 
11
- from emu_base.lindblad_operators import get_lindblad_operators
11
+ from emu_base.jump_lindblad_operators import get_lindblad_operators
12
12
  from emu_base.utils import dist2, dist3
13
13
 
14
14
 
@@ -228,9 +228,11 @@ class PulserData:
228
228
  phi: torch.Tensor
229
229
  hamiltonian_type: HamiltonianType
230
230
  lindblad_ops: list[torch.Tensor]
231
+ qubit_ids: tuple[QubitId, ...]
231
232
 
232
233
  def __init__(self, *, sequence: pulser.Sequence, config: EmulationConfig, dt: int):
233
- self.qubit_count = len(sequence.register.qubit_ids)
234
+ self.qubit_ids = sequence.register.qubit_ids
235
+ self.qubit_count = len(self.qubit_ids)
234
236
  sequence_duration = sequence.get_duration()
235
237
  # the end value is exclusive, so add +1
236
238
  observable_times = set(torch.arange(0, sequence.get_duration() + 1, dt).tolist())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emu-base
3
- Version: 2.0.3
3
+ Version: 2.1.0
4
4
  Summary: Pasqal base classes for emulators
5
5
  Project-URL: Documentation, https://pasqal-io.github.io/emulators/
6
6
  Project-URL: Repository, https://github.com/pasqal-io/emulators
@@ -0,0 +1,13 @@
1
+ emu_base/__init__.py,sha256=nssAwoVeRB5OiBuBJcOzcfggDXp5IDB-2Xyft0kke6A,493
2
+ emu_base/aggregators.py,sha256=bB-rldoDAErxQMpL715K5lpiabGOpkCY0GyxW7mfHuc,5000
3
+ emu_base/constants.py,sha256=41LYkKLUCz-oxPbd-j7nUDZuhIbUrnez6prT0uR0jcE,56
4
+ emu_base/jump_lindblad_operators.py,sha256=Y30f8emVFS4Dazljc_Rh4lX9qU4QQY_AxPNahnzcsfY,2101
5
+ emu_base/pulser_adapter.py,sha256=jDNUpVDlcxfUgI3q5vGfB34YZI1prT39wf--HOwkOJA,11330
6
+ emu_base/utils.py,sha256=RM8O0qfPAJfcdqqAojwEEKV7I3ZfVDklnTisTGhUg5k,233
7
+ emu_base/math/__init__.py,sha256=6BbIytYV5uC-e5jLMtIErkcUl_PvfSNnhmVFY9Il8uQ,97
8
+ emu_base/math/brents_root_finding.py,sha256=AVx6L1Il6rpPJWrLJ7cn6oNmJyZOPRgEaaZaubC9lsU,3711
9
+ emu_base/math/double_krylov.py,sha256=X16dyCbyzdP7fFK-hmKS03Q-DJtC6TZ8sJrGTJ6akIc,3708
10
+ emu_base/math/krylov_exp.py,sha256=MNLxgtiy2djRVtmXmtlBQ6A8rSuw1OK6dTtRQUZvaHs,3854
11
+ emu_base-2.1.0.dist-info/METADATA,sha256=jkK_Y2sC5TRpYjxxTCouMtOklpiRu_EXSGpC6gkNp-s,3522
12
+ emu_base-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ emu_base-2.1.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- emu_base/__init__.py,sha256=FCku0o69e9ebQ5E2dYP2eVJeS9NC9O56AMEml0-vq7M,493
2
- emu_base/aggregators.py,sha256=bB-rldoDAErxQMpL715K5lpiabGOpkCY0GyxW7mfHuc,5000
3
- emu_base/constants.py,sha256=41LYkKLUCz-oxPbd-j7nUDZuhIbUrnez6prT0uR0jcE,56
4
- emu_base/lindblad_operators.py,sha256=Nsl1YrWb8IDM9Z50ucy2Ed44p_IRETnlbr6qaqAgV50,1629
5
- emu_base/pulser_adapter.py,sha256=dRD80z_dVXkCjDBLRIkmqNGg5M78VEKkQuk3H5JdZSM,11241
6
- emu_base/utils.py,sha256=RM8O0qfPAJfcdqqAojwEEKV7I3ZfVDklnTisTGhUg5k,233
7
- emu_base/math/__init__.py,sha256=6BbIytYV5uC-e5jLMtIErkcUl_PvfSNnhmVFY9Il8uQ,97
8
- emu_base/math/brents_root_finding.py,sha256=AVx6L1Il6rpPJWrLJ7cn6oNmJyZOPRgEaaZaubC9lsU,3711
9
- emu_base/math/double_krylov.py,sha256=-DUZ5R3g7CUMQWSET2MUxXZKObXgLNanwAtS5nX8T68,3677
10
- emu_base/math/krylov_exp.py,sha256=MNLxgtiy2djRVtmXmtlBQ6A8rSuw1OK6dTtRQUZvaHs,3854
11
- emu_base-2.0.3.dist-info/METADATA,sha256=vT_PZe1y41tVG2uljU4pz3HnSTBFzjVRk2swqQOx0ws,3522
12
- emu_base-2.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- emu_base-2.0.3.dist-info/RECORD,,