qc2.algorithms.pennylane.iqpe

Module defining QPE algorithm for PennyLane.

Classes

IQPE

Module Contents

class qc2.algorithms.pennylane.iqpe.IQPE(qc2data=None, active_space=None, mapper=None, device=None, reference_state=None, num_iterations=None, verbose=0)[source]

Bases: qc2.algorithms.pennylane.pebase.PEBase

num_iterations = 3[source]
num_evaluation_qubits = 1[source]
get_phase()[source]

Estimate the phase from the quantum circuit.

The method executes the quantum circuit and determines the most probable measurement outcome’s index. This index is then divided by 2 raised to the power of the number of evaluation qubits to estimate the phase.

Returns:

The estimated phase.

Return type:

float

static _build_circuit(dev: str, qubits: int, num_estimation_wires: int, reference_state: pennylane.numpy.ndarray, unitary_op: pennylane.operation.Operator, device_args=None, device_kwargs=None, qnode_args=None, qnode_kwargs=None) pennylane.QNode[source]

Builds and return PennyLane QNode.

Parameters:
  • dev (str) – PennyLane quantum device.

  • qubits (int) – Number of qubits in the circuit.

  • num_estimation_wires (int) – number of qubits for estimation

  • reference_state (np.ndarray) – Reference state for the circuit.

  • unitary_op (Operator) – Qubit operator for the exp(iH).

  • device_args (list, optional) – Additional arguments for the quantum device. Defaults to None.

  • device_kwargs (dict, optional) – Additional keyword arguments for the quantum device. Defaults to None.

  • qnode_args (list, optional) – Additional arguments for the QNode. Defaults to None.

  • qnode_kwargs (dict, optional) – Additional keyword arguments for the QNode. Defaults to None.

Returns:

PennyLane qnode with built-in ansatz.

Return type:

QNode