qoqo.operations.PragmaSetDensityMatrix

class qoqo.operations.PragmaSetDensityMatrix

This PRAGMA operation sets the density matrix of a quantum register.

The Circuit() module automatically initializes the qubits in the |0> state, so this PRAGMA operation allows you to set the state of the qubits by setting a density matrix of your choosing.

Parameters:

density_matrix (a 2d array of complex numbers) – The density matrix that is initialized.

__init__()

Methods

__init__()

density_matrix()

Return the set density matrix.

hqslang()

Return hqslang name of the operation.

involved_qubits()

List all involved qubits (here, all).

is_parametrized()

Return true when the operation has symbolic parameters.

remap_qubits(mapping)

Remap qubits in a clone of the PRAGMA operation.

substitute_parameters(substitution_parameters)

Substitute the symbolic parameters in a clone of the PRAGMA operation according to the input.

tags()

Return tags classifying the type of the operation.

density_matrix()

Return the set density matrix.

Returns:

The density matrix (2d array) representing the qubit register.

Return type:

np.ndarray

hqslang()

Return hqslang name of the operation.

Returns:

The hqslang name of the operation.

Return type:

str

involved_qubits()

List all involved qubits (here, all).

Returns:

The involved qubits of the PRAGMA operation.

Return type:

set[int]

is_parametrized()

Return true when the operation has symbolic parameters.

Returns:

True if the operation contains symbolic parameters, False if it does not.

Return type:

bool

remap_qubits(mapping)

Remap qubits in a clone of the PRAGMA operation.

Parameters:

mapping (dict[int, int]) – The dictionary containing the {qubit: qubit} mapping to use in the PRAGMA operation.

Returns:

The PRAGMA operation with the qubits remapped.

Return type:

self

Raises:

RuntimeError – The qubit remapping failed.

substitute_parameters(substitution_parameters)

Substitute the symbolic parameters in a clone of the PRAGMA operation according to the input.

Parameters:

substitution_parameters (dict[str, float]) – The dictionary containing the substitutions to use in the PRAGMA operation.

Returns:

The PRAGMA operation with the parameters substituted.

Return type:

self

Raises:

RuntimeError – The parameter substitution failed.

tags()

Return tags classifying the type of the operation.

Used for type based dispatch in ffi interfaces.

Returns:

The tags of the Operation.

Return type:

list[str]