qiskit.aqua.components.initial_states.VarFormBased¶
-
class
VarFormBased
(var_form, params)[código fonte]¶ 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 forIQPE
by using this class.- Parâmetros
var_form (
Union
[VariationalForm
,QuantumCircuit
]) – The variational form.params (
Union
[List
[float
],ndarray
,Dict
[Parameter
,float
]]) – Parameters for the variational form.
- Levanta
ValueError – Invalid input
-
__init__
(var_form, params)[código fonte]¶ - Parâmetros
var_form (
Union
[VariationalForm
,QuantumCircuit
]) – The variational form.params (
Union
[List
[float
],ndarray
,Dict
[Parameter
,float
]]) – Parameters for the variational form.
- Levanta
ValueError – Invalid input
Methods
__init__
(var_form, params)- type var_form
Union
[VariationalForm
,QuantumCircuit
]
construct_circuit
([mode, register])Construct the statevector of desired initial state.
-
construct_circuit
(mode='circuit', register=None)[código fonte]¶ Construct the statevector of desired initial state.
- Parâmetros
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.
- Retorna
statevector.
- Tipo de retorno
QuantumCircuit or numpy.ndarray
- Levanta
RuntimeError – invalid input for mode
AquaError – when mode is not ‘vector’ or ‘circuit’.