Class NoiseModel

Inheritance Relationships

Derived Type

Class Documentation

class NoiseModel

Noise Model class This allows specification noise parameters for each quantum gate.

Subclassed by qb::QbNoiseModel

Public Types

enum class QubitConnectivity

Type of qubit connectivity.

Values:

enumerator AllToAll
enumerator Custom

Public Functions

NoiseModel() = default
NoiseModel(const nlohmann::json &js)

Construct a new Noise Model object from JSON.

Parameters:

js – JSON object contains noise model parameters

NoiseModel(const NoiseProperties &noise_props)

Construct a new Noise Model object from noise properties.

Parameters:

noise_props – Device noise properties

NoiseModel(const std::string &name, size_t nb_qubits, std::optional<QubitConnectivity> connectivity = std::nullopt, std::optional<std::reference_wrapper<const std::vector<std::pair<size_t, size_t>>>> connected_pairs = std::nullopt)

Build and return a registered noise model. Optionally allows for customization, e.g., number of qubits, if supported.

IMPORTANT NOTE: The ability to build and return some noise models requires the Qristal Emulator library libqbemulator.so to be found at runtime. To dynamically load libqbemulator.so requires: (1) For Python users: libqbemulator.so is installed in the lib/ directory of the QB’s core package (i.e., the same location as the core Python package itself) (2) For C++ users: if building an executable linking against libqbcore, you need to set the rpath of your executable target to include the directory where libqbemulator.so located. In both cases, LD_LIBRARY_PATH can also be used to point the dynamic linker to the location of libqbemulator.so (if setting rpath fails).

Parameters:
  • name – The name of the registered noise model.

  • nb_qubits – Number of qubits

  • connectivity – [Optional] Connectivity pattern

  • connected_pairs – [Optional] Custom connectivity topology (if not AllToAll)

Returns:

Noise model object

std::string to_json() const

Convert noise model to json string.

Returns:

JSON string

std::vector<std::pair<int, int>> get_connectivity() const

Get the connectivity (pairs of connected qubits)

Returns:

Connectivity as list of qubit index pairs

const std::unordered_map<size_t, ReadoutError> &get_readout_errors() const

Get the readout errors.

Returns:

Map from qubit index to readout errors

const std::unordered_map<std::string, std::map<std::vector<size_t>, std::vector<NoiseChannel>>> &get_noise_channels() const

Get all the gate noise channels.

Returns:

Map from (gate name + qubit operands) to noise channels

void add_gate_error(const NoiseChannel &noise_channel, const std::string &gate_name, const std::vector<size_t> &qubits)

Add a gate error channel for a gate operation.

Parameters:
  • noise_channel – Noise channel to be associated with the gate

  • gate_name – Name of the gates

  • qubits – Qubit indices of the gate.

void add_qubit_connectivity(int q1, int q2)

Add a connected qubit pair to the topology model.

Parameters:
  • q1 – First qubit index

  • q2 – Second qubit index

void set_qubit_readout_error(size_t qubitIdx, const ReadoutError &ro_error)

Set the qubit readout error.

Parameters:
  • qubitIdx – Qubit to set

  • ro_error – Readout error

std::string get_qobj_compiler() const

Retrieve the name of the QObj compiler to use with the AER simulator.

Returns:

Name of the QObj compiler

void set_qobj_compiler(const std::string &qobj_compiler)

Set the name of the QObj compiler to use with the AER simulator Throw if the compiler name is invalid.

std::vector<std::string> get_qobj_basis_gates() const

Return the list of basis gates that the AER QObj will be referring to.

Returns:

List of basis gates. Note: This corresponds to which QObj compiler being set. The AER simulator will only look for gate noise associated with these gates.

inline operator noise_aware_placement_config() const noexcept

Conversion into a noise_aware_placement_config.

Public Members

std::string name

The colloquial name of the noise model.

Protected Functions

double decoherence_pauli_error(double t1, double tphi, double gate_time)

Calculate component of Pauli error caused by decoherence on a single qubit.

Parameters:
  • t1 – T1 time

  • tphi – Tphi time

  • gate_time – Duration of the gate affected by this error.

Returns:

Calculated Pauli error resulting from decoherence.

noise_aware_placement_config to_noise_aware_placement_config() const

Helper method to convert this NoiseModel into a noise aware placement configuration.

Returns:

noise_aware_placement_config

Protected Attributes

std::unordered_map<std::string, std::map<std::vector<size_t>, std::vector<NoiseChannel>>> m_noise_channels

Gate noise channel registry Map from gate name -> a map of qubit operands -> noise channel If the noise is uniform (qubit independent), use empty vector for qubit operands.

std::unordered_map<size_t, ReadoutError> m_readout_errors

Readout errors.

std::vector<std::pair<int, int>> m_qubit_topology

Qubit connectivity.

nlohmann::json m_qobj_noise_model

Noise model Json conforming to IBM Qiskit QObj schema if provided.

std::string m_qobj_compiler = "xacc-qobj"

Name of the QObj compiler to use with the AER simulator.

Protected Static Functions

static void make_default(NoiseModel &make_from_this, size_t nb_qubits, QubitConnectivity connectivity = QubitConnectivity::AllToAll, const std::vector<std::pair<size_t, size_t>> &connected_pairs = {})

Build and return the default noise model. Optionally allows for customization, e.g., number of qubits, if supported.

Parameters:
  • make_from_this – The NoiseModel instance to build into the default noise model.

  • nb_qubits – Number of qubits

  • connectivity – [Optional] Connectivity pattern

  • connected_pairs – [Optional] Custom connectivity topology (if not AllToAll)

Returns:

Noise model object