State vector
AnalogGate
dataclass
AnalogGate(hamiltonian: RydbergHamiltonian)
run
run(
shots: int = 1,
solver_name: str = "dop853",
atol: float = 1e-14,
rtol: float = 1e-07,
nsteps: int = 2147483647,
interaction_picture: bool = False,
project_hyperfine: bool = True,
) -> NDArray[np.uint8]
Run the emulation with all atoms in the ground state, sampling the final state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
|
RydbergHamiltonian
dataclass
RydbergHamiltonian(
emulator_ir: EmulatorProgram,
space: Space,
rydberg: NDArray,
detuning_ops: List[DetuningOperator] = list(),
rabi_ops: List[RabiOperator] = list(),
)
Hamiltonian for a given task.
With the RydbergHamiltonian
you can convert the Hamiltonian to CSR matrix form
as well as obtaining the average energy/variance of a register.
Attributes:
Name | Type | Description |
---|---|---|
emulator_ir |
EmulatorProgram
|
A copy of the original program used to generate the RydbergHamiltonian |
space |
Space
|
The Hilbert space of the Hamiltonian, should align with the register the Hamiltonian is being applied on for average energy/variance |
rydberg |
NDArray
|
Rydberg interaction operator |
detuning_ops |
List[DetuningOperator]
|
Detuning Operators of the Hamiltonian |
rabi_ops |
List[RabiOperator]
|
Rabi Operators of the Hamiltonian |
average
average(
register: StateVector, time: Optional[float] = None
) -> float
Get energy average from RydbergHamiltonian object at time time
with
register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take average with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
average energy at time |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
average_and_variance
average_and_variance(
register: StateVector, time: Optional[float] = None
) -> Tuple[float, float]
Get energy average and variance from RydbergHamiltonian object at time time
with register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take average and variance with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Type | Description |
---|---|
float
|
Tuple[float, float]: average and variance of energy at time |
float
|
respectively. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
tocsr
tocsr(time: float) -> csr_matrix
Return the Hamiltonian as a csr matrix at time time
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
float
|
time to evaluate the Hamiltonian at. |
required |
Returns:
Name | Type | Description |
---|---|---|
csr_matrix |
csr_matrix
|
The Hamiltonian as a csr matrix. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
variance
variance(
register: StateVector, time: Optional[float] = None
) -> float
Get the energy variance from RydbergHamiltonian object at
time time
with register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take variance with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Name | Type | Description |
---|---|---|
complex |
float
|
variance of energy at time |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
StateVector
dataclass
StateVector(data: NDArray, space: Space)
local_trace
local_trace(
matrix: ndarray, site_index: Union[int, Tuple[int, int]]
) -> complex
return trace of an operator over the StateVector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
ndarray
|
Square matrix representing operator in the local hilbert space. |
required |
site_index
|
int | Tuple[int, int]
|
sites to apply one body operator to. |
required |
Returns:
Name | Type | Description |
---|---|---|
complex |
complex
|
the trace of the operator over the state-vector. |
Raises:
Type | Description |
---|---|
ValueError
|
Error is raised when the dimension of |
ValueError
|
Error is raised when the |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
norm
norm() -> float
Return the norm of the state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
215 216 217 |
|
normalize
normalize() -> None
Normalize the state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
210 211 212 213 |
|
sample
sample(
shots: int, project_hyperfine: bool = True
) -> NDArray
Sample the state vector and return bitstrings.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
204 205 206 207 208 |
|