qiskit-documentation/docs/api/qiskit/0.45/qiskit.opflow.converters.Di...

47 lines
2.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: DictToCircuitSum
description: API reference for qiskit.opflow.converters.DictToCircuitSum
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.opflow.converters.DictToCircuitSum
---
# DictToCircuitSum
<Class id="qiskit.opflow.converters.DictToCircuitSum" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/opflow/converters/dict_to_circuit_sum.py" signature="qiskit.opflow.converters.DictToCircuitSum(traverse=True, convert_dicts=True, convert_vectors=True)" modifiers="class">
Bases: [`ConverterBase`](qiskit.opflow.converters.ConverterBase "qiskit.opflow.converters.converter_base.ConverterBase")
Deprecated: Converts `DictStateFns` or `VectorStateFns` to equivalent `CircuitStateFns` or sums thereof. The behavior of this class can be mostly replicated by calling `to_circuit_op` on an Operator, but with the added control of choosing whether to convert only `DictStateFns` or `VectorStateFns`, rather than both.
<Admonition title="Deprecated since version 0.24.0" type="danger">
The class `qiskit.opflow.converters.dict_to_circuit_sum.DictToCircuitSum` is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit [https://qisk.it/opflow\_migration](https://qisk.it/opflow_migration).
</Admonition>
**Parameters**
* **traverse** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) Whether to recurse down into Operators with internal sub-operators for conversion.
* **convert\_dicts** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) Whether to convert VectorStateFn.
* **convert\_vectors** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.12)")) Whether to convert DictStateFns.
## Methods
### convert
<Function id="qiskit.opflow.converters.DictToCircuitSum.convert" signature="convert(operator)">
Convert the Operator to `CircuitStateFns`, recursively if `traverse` is True.
**Parameters**
**operator** ([*OperatorBase*](qiskit.opflow.OperatorBase "qiskit.opflow.operator_base.OperatorBase")) The Operator to convert
**Returns**
The converted Operator.
**Return type**
[*OperatorBase*](qiskit.opflow.OperatorBase "qiskit.opflow.operator_base.OperatorBase")
</Function>
</Class>