qoqo.operations.PragmaSetStateVector

class qoqo.operations.PragmaSetStateVector

This PRAGMA operation sets the statevector 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 to a state of your choosing. For instance, to initialize the psi-minus Bell state, we pass the following vector to the PRAGMA:

vector = np.array([0, 1 / np.sqrt(2), -1 / np.sqrt(2), 0])

Parameters:

internal (PragmaSetStateVector) – The statevector that is initialized.

__init__()

Methods

__init__()

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.

statevector()

Return the statevector.

substitute_parameters(substitution_parameters)

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

tags()

Return tags classifying the type of the operation.

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.

statevector()

Return the statevector.

Returns:

The statevector representing the qubit register.

Return type:

np.ndarray

substitute_parameters(substitution_parameters)

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

Parameters:

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

Returns:

The PRAGMA operation 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 the type based dispatch in ffi interfaces.

Returns:

The tags of the operation.

Return type:

list[str]