Operator

class Operator(operator)

Represent an operator.

Initialize an instance of the Operator class.

Parameters:

operator (ndarray | Array | str) –

Must be

  • ndarray|Array: The operator as a matrix itself.

  • str: Pauli bitstring (sequence of 'I', 'X', 'Y', 'Z').

Methods

expectation_value(state)

Return the expectation value of the operator with respect to the state.

Attributes

matrix

Matrix representation of the operator.

name

Name of the operator.