Operator

QuantumHamiltonian.jl uses operators in the "projector" representation.

Operator Types

NullOperator

A NullOperator, as the name suggests, represents a null operator. It contains no fields, and is thus a singleton.

PureOperator

A PureOperator represents an operator of the following form:

\[\hat{O} = \alpha \hat{P}_1 \otimes \hat{P}_2 \otimes \ldots \otimes \hat{P}_N\]

where $\alpha$ is a complex number, and $\hat{P}_i$ is either identity, or projection $|rᵢ⟩⟨cᵢ|$. It serves as a building block for all the operators used for the construction of the representation of the operators.

Internally, PureOperator has fields bitmask, bitrow, bitcol, and amplitude. The bitmask marks whether the $\hat{P}_i$ is identity or projection: If the bitmask for site i is unset, then $\hat{P}_i$ is an identity operator; if it is set, then $\hat{P}_{i}$ is a projection. The fields bitrow and bitcol can contain information on rᵢ and cᵢ: They can contain nonzero bit-field only at sites with nonzero bitmask.

SumOperator

A SumOperator represents a sum of PureOperator. The scalar types of the PureOperators are required to be the same. While a SumOperator can be constructed from the PureOperators, it can also be constructed using additions/subtractions (See Binary Operations).

Mathematical Operations for Operators

Unary Operations

Unary operations + and - are defined for the operators. These simply act on the overall amplitude of the operators. + does not do anything and simply returns the original operator, while - changes sign only. The type of the resulting operator, is therefore the same as the original operator. There is one exception: when acting - on an operator whose scalar type is Bool, the resulting type has scalar type Int.

In addition to + and -, functions real and imag are also defined for the operators. Depending on the scalar type, the resulting operator has a different type:

.NPRPCSRSC
realNPRPRSRSR
imagNNPRNSR

Binary Operations

Binary operations are also defined for the operators. Since PureOperators are closed under multiplication, while product of NullOperator and any operator is always NullOperator, we get the following multiplication table

*NPS
NNNN
PNPS
SNSS

Additions or subtractions of two PureOperators, on the other hand, produce SumOperators

+/-NPS
NNPS
PPSS
SSSS