QCloudNoiseModel
QCloudNoiseModel represents a noise model for cloud-based quantum simulations. It encapsulates the noise type and its associated parameters for single-qubit and two-qubit gates.
Signature
QCloudNoiseModel()
QCloudNoiseModel(model: NOISE_MODEL, single_p: list[float], double_p: list[float])Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| model | NOISE_MODEL | required | The noise model type |
| single_p | list[float] | required | Single-qubit gate noise parameters |
| double_p | list[float] | required | Two-qubit gate noise parameters |
The default constructor creates a disabled noise model (no noise applied).
Methods
get_noise_model
get_noise_model() -> strReturns the noise model type as a string.
Returns: The noise model name string.
get_single_params
get_single_params() -> list[float]Returns the single-qubit gate noise parameters.
Returns: A list of floating-point noise parameters for single-qubit gates.
set_single_params
set_single_params(single: list[float]) -> NoneSets the single-qubit gate noise parameters.
| Parameter | Type | Description |
|---|---|---|
| single | list[float] | The single-qubit noise parameters |
get_double_params
get_double_params() -> list[float]Returns the two-qubit gate noise parameters.
Returns: A list of floating-point noise parameters for two-qubit gates.
set_double_params
set_double_params(double_p: list[float]) -> NoneSets the two-qubit gate noise parameters.
| Parameter | Type | Description |
|---|---|---|
| double_p | list[float] | The two-qubit noise parameters |
is_enabled
is_enabled() -> boolChecks whether the noise model is enabled (i.e., has been configured with a noise type and parameters).
Returns: True if the noise model is enabled, False otherwise.
print
print() -> NonePrints the noise model type and its parameters to standard output.
Operators
| Operator | Description |
|---|---|
== | Compares two QCloudNoiseModel objects for equality |
!= | Compares two QCloudNoiseModel objects for inequality |
Examples
from pyqpanda3.qcloud import QCloudNoiseModel, NOISE_MODEL
# Create a default (disabled) noise model
no_noise = QCloudNoiseModel()
print("Enabled:", no_noise.is_enabled()) # False
# Create a depolarizing noise model
noise = QCloudNoiseModel(
model=NOISE_MODEL.DEPOLARIZING_KRAUS_OPERATOR,
single_p=[0.001], # Single-qubit depolarizing probability
double_p=[0.01] # Two-qubit depolarizing probability
)
print("Enabled:", noise.is_enabled()) # True
print("Model:", noise.get_noise_model())
# Use the noise model with a backend
job = backend.run(prog, shots=1000, model=noise)
# Modify noise parameters
noise.set_single_params([0.002])
noise.set_double_params([0.02])
noise.print()See Also
- NOISE_MODEL -- Available noise model types
- QCloudService -- Cloud service and backend for running with noise