requsim.noise module
Classes:
|
Standardized way to define noise channels. |
|
Class for describing noise in a standardized way. |
Functions:
|
Turn NoiseChannel with variable arguments into a static noise channel. |
- class requsim.noise.NoiseChannel(n_qubits, channel_function)
Bases:
objectStandardized way to define noise channels.
This class can be simply called to apply this channel on a state of the correct number of qubits, or you can use the apply_to method to let the noise channel handle its application for you.
- Parameters
n_qubits (int) – This noise channel acts on n_qubits input qubits.
channel_function (callable) – The function describing the channel.
- Variables
n_qubits –
Methods:
apply_to(rho, qubit_indices, *args, **kwargs)Apply the noise channel to specified qubits of a state rho.
- apply_to(rho, qubit_indices, *args, **kwargs)
Apply the noise channel to specified qubits of a state rho.
- Parameters
rho (np.ndarray) – The density matrix the channel is applied to.
qubit_indices (list of ints) – Numbering of qubits runs from 0…n-1
*args (are handed through to the appropriate function) –
**kwargs (are handed through to the appropriate function) –
- Returns
np.ndarray – The state after the channel has been applied.
- class requsim.noise.NoiseModel(channel_before: Optional[NoiseChannel] = None, map_replace: Optional[callable] = None, channel_after: Optional[NoiseChannel] = None)
Bases:
objectClass for describing noise in a standardized way.
- Parameters
channel_before (NoiseChannel or None) – Channel that is applied before the operation. Default: None
map_replace (callable or None) – This noisy callable replaces whatever the operation tries to do. Default: None (May not be supported by all processes.)
channel_after (NoiseChannel or None) – Channel that is applied after the operation. Default: None
- Variables
channel_before (Optional[requsim.noise.NoiseChannel]) –
map_replace (Optional[callable]) –
channel_after (Optional[requsim.noise.NoiseChannel]) –
Attributes:
- channel_before: Optional[NoiseChannel] = None
- map_replace: Optional[callable] = None
- channel_after: Optional[NoiseChannel] = None
- requsim.noise.freeze_noise_channel(noise_channel, *args, **kwargs)
Turn NoiseChannel with variable arguments into a static noise channel.
This is useful when the application of the channel is delayed, so the args and kwargs do not need to be stored separately until that happens.
- Parameters
noise_channel (NoiseChannel) – Description of parameter noise_channel.
*args (type) – Description of parameter *args.
**kwargs (type) – Description of parameter **kwargs.
- Returns
type – Description of returned object.