From 0dbeeb4d7dc2088b50a1134a8f958dab7d223d0d Mon Sep 17 00:00:00 2001 From: Rochisha Agarwal Date: Tue, 16 Jul 2024 10:16:57 +0530 Subject: [PATCH] change file name --- qutip/core/metrics.py | 2 +- qutip/entropy.py | 11 +++++------ qutip/{backend.py => numpy_backend.py} | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) rename qutip/{backend.py => numpy_backend.py} (93%) diff --git a/qutip/core/metrics.py b/qutip/core/metrics.py index c402381fa5..e5260e16c0 100644 --- a/qutip/core/metrics.py +++ b/qutip/core/metrics.py @@ -9,7 +9,7 @@ 'hellinger_dist', 'hilbert_dist', 'average_gate_fidelity', 'process_fidelity', 'unitarity', 'dnorm'] -from ..backend import np +from ..numpy_backend import np from scipy import linalg as la import scipy.sparse as sp from .superop_reps import to_choi, _to_superpauli, to_super, kraus_to_choi diff --git a/qutip/entropy.py b/qutip/entropy.py index 1adb960c9f..3b84e9cc13 100644 --- a/qutip/entropy.py +++ b/qutip/entropy.py @@ -2,15 +2,14 @@ 'concurrence', 'entropy_conditional', 'entangling_power', 'entropy_relative'] -from .backend import np -from math import e +from .numpy_backend import np from .partial_transpose import partial_transpose from . import (ptrace, tensor, sigmay, ket2dm, expand_operator) from .core import data as _data -def entropy_vn(rho, base=e, sparse=False): +def entropy_vn(rho, base=np.e, sparse=False): """ Von-Neumann entropy of density matrix @@ -150,7 +149,7 @@ def negativity(rho, subsys, method='tracenorm', logarithmic=False): return N -def entropy_mutual(rho, selA, selB, base=e, sparse=False): +def entropy_mutual(rho, selA, selB, base=np.e, sparse=False): """ Calculates the mutual information S(A:B) between selection components of a system density matrix. @@ -192,7 +191,7 @@ def entropy_mutual(rho, selA, selB, base=e, sparse=False): return out -def entropy_relative(rho, sigma, base=e, sparse=False, tol=1e-12): +def entropy_relative(rho, sigma, base=np.e, sparse=False, tol=1e-12): """ Calculates the relative entropy S(rho||sigma) between two density matrices. @@ -288,7 +287,7 @@ def entropy_relative(rho, sigma, base=e, sparse=False, tol=1e-12): return np.maximum(0, S) -def entropy_conditional(rho, selB, base=e, sparse=False): +def entropy_conditional(rho, selB, base=np.e, sparse=False): """ Calculates the conditional entropy :math:`S(A|B)=S(A,B)-S(B)` of a selected density matrix component. diff --git a/qutip/backend.py b/qutip/numpy_backend.py similarity index 93% rename from qutip/backend.py rename to qutip/numpy_backend.py index 5f79c7aafc..5139de4bf2 100644 --- a/qutip/backend.py +++ b/qutip/numpy_backend.py @@ -10,4 +10,4 @@ def __getattr__(self, name): return getattr(backend, name) # Initialize the numpy backend -np = NumpyBackend() \ No newline at end of file +np = NumpyBackend()