Spanish
Idiomas
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

Initialize

class Initialize(params, num_qubits=None)[fuente]

Bases: Instruction

Complex amplitude initialization.

Class that initializes some flexible collection of qubit registers, implemented by calling the qiskit.extensions.StatePreparation Class. Note that Initialize is an Instruction and not a Gate since it contains a reset instruction, which is not unitary.

Create new initialize composite.

Parámetros
  • params (str, list, int or Statevector) –

    • Statevector: Statevector to initialize to.

    • list: vector of complex amplitudes to initialize to.

    • string: labels of basis states of the Pauli eigenstates Z, X, Y. See Statevector.from_label(). Notice the order of the labels is reversed with respect to the qubit index to be applied to. Example label “01” initializes the qubit zero to \(|1\rangle\) and the qubit one to \(|0\rangle\).

    • int: an integer that is used as a bitmap indicating which qubits to initialize to \(|1\rangle\). Example: setting params to 5 would initialize qubit 0 and qubit 2 to \(|1\rangle\) and qubit 1 to \(|0\rangle\).

  • num_qubits (int) – This parameter is only used if params is an int. Indicates the total number of qubits in the initialize call. Example: initialize covers 5 qubits and params is 3. This allows qubits 0 and 1 to be initialized to \(|1\rangle\) and the remaining 3 qubits to be initialized to \(|0\rangle\).

Methods

add_decomposition

Add a decomposition of the instruction to the SessionEquivalenceLibrary.

assemble

Assemble a QasmQobjInstruction

broadcast_arguments

Validation of the arguments.

c_if

Set a classical equality condition on this instruction between the register or cbit classical and value val.

copy

Copy of the instruction.

gates_to_uncompute

Call to create a circuit with gates that take the desired vector to zero.

inverse

Invert this instruction.

is_parameterized

Return True .IFF.

qasm

Return a default OpenQASM string for the instruction.

repeat

Creates an instruction with gate repeated n amount of times.

reverse_ops

For a composite instruction, reverse the order of sub-instructions.

soft_compare

Soft comparison between gates.

validate_parameter

Instruction parameters has no validation or normalization.

Attributes

condition_bits

Get Clbits in condition.

decompositions

Get the decompositions of the instruction from the SessionEquivalenceLibrary.

definition

Return definition in terms of other basic gates.

duration

Get the duration.

label

Return instruction label

name

Return the name.

num_clbits

Return the number of clbits.

num_qubits

Return the number of qubits.

params

Return initialize params.

unit

Get the time unit of duration.