OperatorBase.to_legacy_op¶
- abstract OperatorBase.to_legacy_op(massive=False)[source]¶
Attempt to return the Legacy Operator representation of the Operator. If self is a
SummedOp
ofPauliOps
, will attempt to convert toWeightedPauliOperator
, and otherwise will simply convert toMatrixOp
and then toMatrixOperator
. The Legacy Operators cannot representStateFns
or properListOps
(meaning not one of theListOp
subclasses), so an error will be thrown if this method is called on such an Operator. Also, Legacy Operators cannot represent unbound Parameter coeffs, so an error will be thrown if any are present in self.Warn if more than 16 qubits to force having to set
massive=True
if such a large vector is desired.- Return type
- Returns
The
LegacyBaseOperator
representing this Operator.- Raises
TypeError – self is an Operator which cannot be represented by a
LegacyBaseOperator
, such asStateFn
, proper (non-subclass)ListOp
, or an Operator with an unbound coeff Parameter.