Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

VarFormBased

class VarFormBased(var_form, params)

GitHub

The variational form based initial state.

This can been useful, say for example, if you have been doing experiments using a VariationalForm and have parameters for a state of interest of that form. Using this class it can then be turned into an initial state for use elsewhere.

As an example this notebook shows where the variational form’s state, from a VQE run, is then used as an initial state for IQPE by using this class.

Parameters

Raises

ValueError – Invalid input


Methods

construct_circuit

VarFormBased.construct_circuit(mode='circuit', register=None)

Construct the statevector of desired initial state.

Parameters

  • mode (string) – vector or circuit. The vector mode produces the vector. While the circuit constructs the quantum circuit corresponding that vector.
  • register (QuantumRegister) – qubits for circuit construction.

Returns

statevector.

Return type

QuantumCircuit or numpy.ndarray

Raises

  • RuntimeError – invalid input for mode
  • AquaError – when mode is not ‘vector’ or ‘circuit’.
Was this page helpful?
Report a bug or request content on GitHub.