Skip to content

Commit 9939b15

Browse files
authored
Merge branch 'main' into dep/update-pdm-lock
2 parents da8d16c + de8013e commit 9939b15

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/bloqade/emulate/ir/state_vector.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,20 @@ def tocsr(self, time: float) -> csr_matrix:
298298

299299
@dataclass(frozen=True)
300300
class RydbergHamiltonian:
301+
"""Hamiltonian for a given task.
302+
With the `RydbergHamiltonian` you can convert the Hamiltonian to CSR matrix form
303+
as well as obtaining the average energy/variance of a register.
304+
305+
Attributes:
306+
emulator_ir (EmulatorProgram): A copy of the original program
307+
used to generate the RydbergHamiltonian
308+
space (Space): The Hilbert space of the Hamiltonian, should align with the register the
309+
Hamiltonian is being applied on for average energy/variance
310+
rydberg (NDArray): Rydberg interaction operator
311+
detuning_ops (List[DetuningOperator]): Detuning Operators of the Hamiltonian
312+
rabi_ops (List[RabiOperator]): Rabi Operators of the Hamiltonian
313+
"""
314+
301315
emulator_ir: EmulatorProgram
302316
space: Space
303317
rydberg: NDArray

src/bloqade/ir/routine/bloqade.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,31 @@ def hamiltonian(
503503
waveform_runtime: str = "interpret",
504504
cache_matrices: bool = False,
505505
) -> List[BloqadeEmulation]:
506+
"""
507+
Generates a list of BloqadeEmulation objects which contain the Hamiltonian of your program.
508+
509+
If you have a variable(s) in your program you have assigned multiple values via `batch_assign()`
510+
there will be multiple `BloqadeEmulation` objects, one for each value. On the other hand
511+
if the program only assumes a singular value per each variable, there will only be
512+
one `BloqadeEmulation` object but it will still be encapsulated in a list.
513+
514+
515+
Args:
516+
*args (LiteralType): If your program has a variable that was declared as run-time assignable
517+
via `.args` you may pass a value to it here. If there are multiple
518+
variables declared via `.args` the order in which you assign values to those variables
519+
through this argument should follow the order in which the declaration occurred.
520+
blockade_radius (float): The radius in which atoms blockade eachother. Default value is 0.0 micrometers.
521+
use_hyperfine (bool): Should the Hamiltonian account for hyperfine levels. Default value is False.
522+
waveform_runtime (str): Specify which runtime to use for waveforms. If "numba" is specify the waveform
523+
is compiled, otherwise it is interpreted via the "interpret" argument. Defaults to "interpret".
524+
cache_matrices (bool): Speed up Hamiltonian generation by reusing data (when possible) from previously generated Hamiltonians.
525+
Default value is False.
526+
527+
Returns:
528+
List[BloqadeEmulation]
506529
530+
"""
507531
ir_iter = self._generate_ir(
508532
args, blockade_radius, waveform_runtime, use_hyperfine
509533
)

0 commit comments

Comments
 (0)