How to use the blueqat.pauli.Term.from_pauli function in blueqat

To help you get started, we’ve selected a few blueqat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Blueqat / Blueqat / blueqat / pauli.py View on Github external
def __neg__(self):
        return Term.from_pauli(self, -1.0)
github Blueqat / Blueqat / blueqat / pauli.py View on Github external
def __truediv__(self, other):
        if isinstance(other, Number):
            if other:
                return Term.from_pauli(self, 1.0 / other)
            raise ZeroDivisionError
        return NotImplemented
github Blueqat / Blueqat / blueqat / pauli.py View on Github external
def to_term(self):
        """Convert to Pauli Term"""
        return Term.from_pauli(self)
github Blueqat / Blueqat / blueqat / pauli.py View on Github external
def __mul__(self, other):
        if isinstance(other, Number):
            return Term.from_pauli(self, other)
        if not isinstance(other, _PauliImpl):
            return NotImplemented
        if self.is_identity:
            return other.to_term()
        if other.is_identity:
            return self.to_term()
        if _n(self) == _n(other) and self.op == other.op:
            return I.to_term()
        return Term.from_paulipair(self, other)
github Blueqat / Blueqat / blueqat / pauli.py View on Github external
def __rmul__(self, other):
        if isinstance(other, Number):
            return Term.from_pauli(self, other)
        return NotImplemented