qiskit.opflow.converters.CircuitSampler.convert¶
- CircuitSampler.convert(operator, params=None)[source]¶
Converts the Operator to one in which the CircuitStateFns are replaced by DictStateFns or VectorStateFns. Extracts the CircuitStateFns out of the Operator, caches them, calls
sample_circuits
below to get their converted replacements, and replaces the CircuitStateFns in operator with the replacement StateFns.- Parameters
operator (OperatorBase) -- The Operator to convert
params (Optional[Dict[Parameter, Union[float, List[float], List[List[float]]]]]) -- A dictionary mapping parameters to either single binding values or lists of binding values.
- Returns
The converted Operator with CircuitStateFns replaced by DictStateFns or VectorStateFns.
- Raises
OpflowError -- if extracted circuits are empty.
- Return type