Observables
rydberggpt.observables
¶
rydberg_energy
¶
get_rydberg_energy(model: RydbergEncoderDecoder, samples: torch.Tensor, cond: torch.Tensor, device: torch.device, undo_sample_path=None, undo_sample_path_args=None) -> torch.Tensor
¶
Calculates energy of the model based on the Hamiltonian defined by cond (graph).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
RydbergEncoderDecoder
|
Model to estimate energy on. |
required |
samples |
Tensor
|
Samples drawn from model based on cond. |
required |
cond |
Tensor
|
A tensor containing the input condition. |
required |
device |
str
|
The device on which to allocate the tensors. Defaults to "cpu". |
required |
undo_sample_path |
Tensor
|
Map that undoes the sample path of the model to match the labelling of in the graph. |
None
|
undo_sample_path_args |
tuple
|
Additional arguments for undo_sample_path. |
None
|
Returns:
Type | Description |
---|---|
Tensor
|
A tensor containing the estimated energy of each sample alongside its decomposition into terms. |
Source code in src/rydberggpt/observables/rydberg_energy.py
get_staggered_magnetization(samples: torch.Tensor, Lx: int, Ly: int, device: torch.device, undo_sample_path=None, undo_sample_path_args=None)
¶
Calculates staggered magnetization of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
samples |
Tensor
|
Samples drawn from model. |
required |
Lx |
int
|
Linear size in the x dimension |
required |
Ly |
int
|
Linear size in the y dimension |
required |
device |
str
|
The device on which to allocate the tensors. Defaults to "cpu". |
required |
undo_sample_path |
Tensor
|
Map that undoes the sample path of the model to match the labelling of in the graph. |
None
|
undo_sample_path_args |
tuple
|
Additional arguments for undo_sample_path. |
None
|
Returns:
Type | Description |
---|---|
Tensor
|
A tensor containing the estimated staggered magnetization of each sample. |
Source code in src/rydberggpt/observables/rydberg_energy.py
get_x_magnetization(model: RydbergEncoderDecoder, samples: torch.Tensor, cond: torch.Tensor, device: torch.device)
¶
Calculates x magnetization of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
RydbergEncoderDecoder
|
Model to estimate energy on. |
required |
samples |
Tensor
|
Samples drawn from model based on cond. |
required |
cond |
Tensor
|
A tensor containing the input condition. |
required |
device |
str
|
The device on which to allocate the tensors. Defaults to "cpu". |
required |
Returns:
Type | Description |
---|---|
Tensor
|
A tensor containing the estimated x magnetization of each sample. |