Skip to main content
IBM Quantum Platform

Protocols

This module provides the protocols used throughout the package.

A typing.Protocol is an interface that a class can fulfill structurally, without explicitly inheriting from it. For example, any class that implements a __len__ method satisfies Sized, whether or not it says so anywhere in its class hierarchy.

The protocols here follow the same idea, each centered on a small set of dunder-style methods. A class implementing them thereby satisfies the protocol and becomes usable wherever it is expected, without any explicit registration.

Protocol
Methods
Helper functions
SupportsCommutators_commutator_, _anti_commutator_, _double_commutator_commutator(), anti_commutator(), double_commutator()
Column 1
Column 2
SupportsCommutators(*args, **kwargs)A Protocol indicating support for efficient commutator generation.
Was this page helpful?
Report a bug, typo, or request content on GitHub.