Restructure Operator class hierarchy

Issue #1 new
E. Madison Bray repo owner created an issue

Right now OperatorBase is the base class for all operator types, whereas Operator is the basic class for an arbitrary concretely defined operator (i.e. its matrix components are directly specified when the Operator is instantiated). This is in contrast to a _CompoundOperator that is the result of an expression of two or more operators of any type.

The problem I have with this is that if you create a "compound operator" like

A = Operator(...)
B = Operator(...)
C = A | B

Although isinstance(C, OperatorBase) is true, it would be more natural to ask isinstance(C, Operator). Although C was created from two other operators, there's no reason it should otherwise be in any way "special". So the restructuring I would would ensure that for all operators a user works with, isinstance(C, Operator) is true.

Likewise for a compound Gate, isinstance(g, Gate) should always be true.

Comments (1)

  1. Log in to comment