Operator Group Module
The operator_group module contains collections of operators for different physical systems.
Base Operator Group
- class qepsilon.operator_group.OperatorGroup(id: str, num_states: int, batchsize: int = 1, static: bool = False)[source]
Bases:
ModuleThis is a base class for operator groups.
- __init__(id: str, num_states: int, batchsize: int = 1, static: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- add_operator(prefactor: float = 1.0)[source]
Add an operator (with a prefactor) to the group. Description of the operator is stored in self._ops. To be implemented in subclasses. :param prefactor: float, the prefactor of the operator.
Composed Operator Groups
- class qepsilon.operator_group.ComposedOperatorGroups(id: str, OP_list: list[OperatorGroup], static: bool = False)[source]
Bases:
OperatorGroup- __init__(id: str, OP_list: list[OperatorGroup], static: bool = False)[source]
Compose multiple operator groups. :param OP_list: a list of operator groups.
- Returns:
The composed operator group.
- to(device='cuda')[source]
This overrides the method of PyTorch Module. It is used to move all operator groups in the composed operator group to a specific device.
Bosonic Operators
- class qepsilon.operator_group.BosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1, static: bool = False)[source]
Bases:
OperatorGroup- __init__(num_modes, id: str, nmax: int, batchsize: int = 1, static: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class qepsilon.operator_group.IdentityBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1)[source]
Bases:
BosonOperatorGroup
- class qepsilon.operator_group.StaticBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1, coef: float = 1.0, static: bool = True, requires_grad: bool = False)[source]
Bases:
BosonOperatorGroupThis class deals with a group of operators (composite boson operators on n-mode systems) and a static coefficient. Each operator is a direct product of boson operators. It is specified by a string of boson operator names. For example, “UDI” is the 2-body operator $$a^dagger_0 otimes a_1 otimes I_2$$.
- class qepsilon.operator_group.HarmonicOscillatorBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int, omega: Tensor, requires_grad: bool = False)[source]
Bases:
BosonOperatorGroupstatic operator H = sum_i omega_i (a_i^dagger a_i + 1/2)
- __init__(num_modes, id: str, nmax: int, batchsize: int, omega: Tensor, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property omega
- class qepsilon.operator_group.WhiteNoiseBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
BosonOperatorGroupThis class deals with a group of operators (composite boson operators on n-mode systems) and a white noise coefficient.
- __init__(num_modes, id: str, nmax: int, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- class qepsilon.operator_group.LangevinNoiseBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
BosonOperatorGroupThis class deals with a group of operators (composite boson operators on n-mode systems) and a Langevin noise coefficient.
- __init__(num_modes, id: str, nmax: int, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- property tau
- property damping
- class qepsilon.operator_group.ColorNoiseBosonOperatorGroup(num_modes, id: str, nmax: int, batchsize: int = 1, tau: float = 1, amp: float = 1, omega: float = 1, requires_grad: bool = False)[source]
Bases:
LangevinNoiseBosonOperatorGroupThis class deals with a group of operators (composite boson operators on n-mode systems) and a color noise coefficient. The autocorrelation function of the color noise is ~exp(-t/tau)cos(omega*t).
Tight-Binding Operators
- class qepsilon.operator_group.TightBindingOperatorGroup(n_sites: int, id: str, batchsize: int = 1, static: bool = False)[source]
Bases:
OperatorGroupThis class represents a group of composite Tight Binding operators on n-site systems.
Each operator in this group is specified by a string of Tight Binding operator names. For example, “XXLXX” is the hopping operator \(| 1\rangle\langle 2 |\).
- __init__(n_sites: int, id: str, batchsize: int = 1, static: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- class qepsilon.operator_group.IdentityTightBindingOperatorGroup(n_sites: int, id: str, batchsize: int = 1, static: bool = True)[source]
Bases:
TightBindingOperatorGroup
- class qepsilon.operator_group.StaticTightBindingOperatorGroup(n_sites: int, id: str, batchsize: int = 1, coef: float = 1, static: bool = True, requires_grad: bool = False)[source]
Bases:
TightBindingOperatorGroupThis class deals with a group of operators (composite Tight Binding operators on n-site systems) and a static coefficient. Each operator in this group is specified by a string of Tight Binding operator names. For example, “XXLXX” is the hopping operator \(| 1\rangle\langle 2 |\).
- class qepsilon.operator_group.PeriodicNoiseTightBindingOperatorGroup(n_sites: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
TightBindingOperatorGroupThis class deals with a group of operators (composite Tight Binding operators on n-site systems) and a periodic noise.
- __init__(n_sites: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
- Parameters:
tau – float, the period of the noise.
amp – float, the amplitude of the noise.
- property amp
- property tau
- class qepsilon.operator_group.WhiteNoiseTightBindingOperatorGroup(n_sites: int, id: str, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
TightBindingOperatorGroupThis class deals with a group of operators (composite Tight Binding operators on n-site systems) and a white noise coefficient.
- __init__(n_sites: int, id: str, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- class qepsilon.operator_group.tb_oscillators_interaction(n_sites: int, id: str, batchsize: int, particles: Particles, coef: Tensor, requires_grad: bool = False)[source]
Bases:
TightBindingOperatorGroupTight Binding particle-(classical) Oscillator interaction as an approximation to Tight binding particle-boson interaction. For each oscillator, the interaction is coef * x * N, where x is the position of the oscillator, and N is the number operator of the tight binding site.
Spin Operators
- class qepsilon.operator_group.PauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, static: bool = False)[source]
Bases:
OperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems). Each operator is a direct product of Pauli operators. It is specified by a string of Pauli operator names. For example, “XI” is the 2-body operator X_1 otimes I_2.
- __init__(n_qubits: int, id: str, batchsize: int = 1, static: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- set_batch_rescaling(batch_rescaling: Tensor)[source]
Set the batch rescaling of the operator group. The final coefficiant will be multiplied by the batch rescaling. :param batch_rescaling: th.Tensor, the batch rescaling of shape (self.nb,).
- class qepsilon.operator_group.IdentityPauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1)[source]
Bases:
PauliOperatorGroup
- class qepsilon.operator_group.StaticPauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, coef: float = 1, static: bool = True, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a static coefficient. Each operator is a direct product of Pauli operators. It is specified by a string of Pauli operator names. For example, “XI” is the 2-body operator X_1 otimes I_2.
- class qepsilon.operator_group.ShotbyShotNoisePauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, amp: float = 1, shift: float = None, static: bool = False, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a shot-by-shot noise coefficient.
- __init__(n_qubits: int, id: str, batchsize: int = 1, amp: float = 1, shift: float = None, static: bool = False, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- class qepsilon.operator_group.WhiteNoisePauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a white noise coefficient.
- __init__(n_qubits: int, id: str, batchsize: int = 1, amp: float = 1, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- class qepsilon.operator_group.PeriodicNoisePauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False, requires_grad_tau_only: bool = False, requires_grad_amp_only: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a periodic noise.
- __init__(n_qubits: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False, requires_grad_tau_only: bool = False, requires_grad_amp_only: bool = False)[source]
- Parameters:
tau – float, the period of the noise.
amp – float, the amplitude of the noise.
- property amp
- property tau
- class qepsilon.operator_group.LangevinNoisePauliOperatorGroup(n_qubits: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a fluctuating coefficient.
- __init__(n_qubits: int, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property amp
- property tau
- property damping
- class qepsilon.operator_group.ColorNoisePauliOperatorGroup(n_qubits, id: str, batchsize: int = 1, tau: float = 1, amp: float = 1, omega: float = 1, requires_grad: bool = False)[source]
Bases:
LangevinNoisePauliOperatorGroupThis class deals with a group of operators (composite Pauli operators on n-qubit systems) and a color noise coefficient. The autocorrelation function of the color noise is ~exp(-t/tau)cos(omega*t).
- class qepsilon.operator_group.DipolarInteraction(n_qubits: int, id: str, batchsize: int, particles: Particles, connectivity: Tensor, prefactor: float = 1, average_nsteps: int = 100, qaxis: Tensor = tensor([0., 1., 0.]), requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with dipolar-dipole interactions.
- __init__(n_qubits: int, id: str, batchsize: int, particles: Particles, connectivity: Tensor, prefactor: float = 1, average_nsteps: int = 100, qaxis: Tensor = tensor([0., 1., 0.]), requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- add_operator(prefactor: float = 1)[source]
Add an operator to the group. Stored as a string of Pauli operator names. :param PauliSequence: str, the Pauli sequence. Example: “XI”
- class qepsilon.operator_group.spin_oscillators_interaction(n_qubits: int, id: str, batchsize: int, particles: Particles, coef: Tensor, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupSpin-(classical) Oscillator interaction as an approximation to spin-boson interaction. For each oscillator, the interaction is coef * x * N, where x is the position of the oscillator, and N is the number operator of the qubit (1 for spin-up, 0 for spin-down).
- class qepsilon.operator_group.DepolarizationChannel(n_qubits: int, id: str, batchsize: int, p: float, requires_grad: bool = False)[source]
Bases:
PauliOperatorGroupThis class deals with a group of Kraus operators.
- __init__(n_qubits: int, id: str, batchsize: int, p: float, requires_grad: bool = False)[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- property p