Skip to content

Commit

Permalink
cleanup: Remove unused features
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-pasquale committed May 30, 2024
1 parent 30cbe29 commit 492202a
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/qibo/models/dbi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@
from qibo.hamiltonians import SymbolicHamiltonian


def commutator(a, b):
"""Compute commutator between two arrays."""
return a @ b - b @ a


def variance(a, state):
"""Calculates the variance of a matrix A with respect to a state:
Var($A$) = $\\langle\\mu|A^2|\\mu\rangle-\\langle\\mu|A|\\mu\rangle^2$"""
b = a @ a
return state.conj().T @ b @ state - (state.conj().T @ a @ state) ** 2


def covariance(a, b, state):
"""This is a generalization of the notion of covariance, needed for the polynomial expansion of the energy fluctuation,
applied to two operators A and B with respect to a state:
Cov($A,B$) = $\\langle\\mu|AB|\\mu\rangle-\\langle\\mu|A|\\mu\rangle\\langle\\mu|B|\\mu\rangle$
"""

c = a @ b + b @ a
return (
state.conj().T @ c @ state
- 2 * state.conj().T @ a @ state * state.conj().T @ b @ state
)


def generate_Z_operators(nqubits: int, backend=None):
"""Generate a dictionary containing 1) all possible products of Pauli Z operators for L = n_qubits and 2) their respective names.
Return: Dictionary with operator names (str) as keys and operators (np.array) as values
Expand Down

0 comments on commit 492202a

Please sign in to comment.