TensoredOp.to_legacy_op

TensoredOp.to_legacy_op(massive=False)

Attempt to return the Legacy Operator representation of the Operator. If self is a SummedOp of PauliOps, will attempt to convert to WeightedPauliOperator, and otherwise will simply convert to MatrixOp and then to MatrixOperator. The Legacy Operators cannot represent StateFns or proper ListOps (meaning not one of the ListOp 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

LegacyBaseOperator

Returns

The LegacyBaseOperator representing this Operator.

Raises

TypeError – self is an Operator which cannot be represented by a LegacyBaseOperator, such as StateFn, proper (non-subclass) ListOp, or an Operator with an unbound coeff Parameter.