QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.quantum_info Namespace Reference

Classes

class  Chi
 
class  Choi
 
class  DensityMatrix
 
class  Kraus
 
class  Matrix
 
class  PTM
 
class  QuantumChannel
 
class  StateSystemType
 
class  StateVector
 
class  SuperOp
 
class  Unitary
 

Functions

float KL_divergence (list[float] p, list[float] q)
 KL_divergence(*args, **kwargs) Overloaded function.
 
float KL_divergence (Callable[[float], float] p_pdf, Callable[[float], float] q_pdf, float x_start, float x_end, float dx=...)
 KL_divergence(*args, **kwargs) Overloaded function.
 
float hellinger_distance (dict[int, float] p, dict[int, float] q)
 hellinger_distance(*args, **kwargs) Overloaded function.
 
float hellinger_distance (dict[str, float] p, dict[str, float] q)
 hellinger_distance(*args, **kwargs) Overloaded function.
 
float hellinger_fidelity (dict[int, float] p, dict[int, float] q)
 hellinger_fidelity(*args, **kwargs) Overloaded function.
 
float hellinger_fidelity (dict[str, float] p, dict[str, float] q)
 hellinger_fidelity(*args, **kwargs) Overloaded function.
 

Function Documentation

◆ hellinger_distance() [1/2]

float pyqpanda3.quantum_info.hellinger_distance ( dict[int, float] p,
dict[int, float] q )

hellinger_distance(*args, **kwargs) Overloaded function.

  1. hellinger_distance(p: dict[int, float], q: dict[int, float]) -> float

Template function to calculate the Hellinger distance between two probability distributions.

Parameters
dist_pA reference to the first probability distribution, represented as an unordered map with keys of type long long and values of type double.
dist_qA reference to the second probability distribution, represented as an unordered map with keys of type long long and values of type double.
Returns
double The Hellinger distance between the two distributions.
  1. hellinger_distance(p: dict[str, float], q: dict[str, float]) -> float

Template function to calculate the Hellinger distance between two probability distributions.

Parameters
dist_pA reference to the first probability distribution, represented as an unordered map with keys of type string and values of type double.
dist_qA reference to the second probability distribution, represented as an unordered map with keys of type string and values of type double.
Returns
double The Hellinger distance between the two distributions.

◆ hellinger_distance() [2/2]

float pyqpanda3.quantum_info.hellinger_distance ( dict[str, float] p,
dict[str, float] q )

hellinger_distance(*args, **kwargs) Overloaded function.

  1. hellinger_distance(p: dict[int, float], q: dict[int, float]) -> float

Template function to calculate the Hellinger distance between two probability distributions.

Parameters
dist_pA reference to the first probability distribution, represented as an unordered map with keys of type long long and values of type double.
dist_qA reference to the second probability distribution, represented as an unordered map with keys of type long long and values of type double.
Returns
double The Hellinger distance between the two distributions.
  1. hellinger_distance(p: dict[str, float], q: dict[str, float]) -> float

Template function to calculate the Hellinger distance between two probability distributions.

Parameters
dist_pA reference to the first probability distribution, represented as an unordered map with keys of type string and values of type double.
dist_qA reference to the second probability distribution, represented as an unordered map with keys of type string and values of type double.
Returns
double The Hellinger distance between the two distributions.

◆ hellinger_fidelity() [1/2]

float pyqpanda3.quantum_info.hellinger_fidelity ( dict[int, float] p,
dict[int, float] q )

hellinger_fidelity(*args, **kwargs) Overloaded function.

  1. hellinger_fidelity(p: dict[int, float], q: dict[int, float]) -> float

Calculates the Hellinger fidelity between two probability distributions represented as unordered maps.

Parameters
dist_pA constant reference to the first probability distribution.
dist_qA constant reference to the second probability distribution.
Returns
double The Hellinger fidelity between the two distributions.
  1. hellinger_fidelity(p: dict[str, float], q: dict[str, float]) -> float

Calculates the Hellinger fidelity between two probability distributions represented as unordered maps.

Parameters
dist_pA constant reference to the first probability distribution.
dist_qA constant reference to the second probability distribution.
Returns
double The Hellinger fidelity between the two distributions.

◆ hellinger_fidelity() [2/2]

float pyqpanda3.quantum_info.hellinger_fidelity ( dict[str, float] p,
dict[str, float] q )

hellinger_fidelity(*args, **kwargs) Overloaded function.

  1. hellinger_fidelity(p: dict[int, float], q: dict[int, float]) -> float

Calculates the Hellinger fidelity between two probability distributions represented as unordered maps.

Parameters
dist_pA constant reference to the first probability distribution.
dist_qA constant reference to the second probability distribution.
Returns
double The Hellinger fidelity between the two distributions.
  1. hellinger_fidelity(p: dict[str, float], q: dict[str, float]) -> float

Calculates the Hellinger fidelity between two probability distributions represented as unordered maps.

Parameters
dist_pA constant reference to the first probability distribution.
dist_qA constant reference to the second probability distribution.
Returns
double The Hellinger fidelity between the two distributions.

◆ KL_divergence() [1/2]

float pyqpanda3.quantum_info.KL_divergence ( Callable[[float], float] p_pdf,
Callable[[float], float] q_pdf,
float x_start,
float x_end,
float dx = ... )

KL_divergence(*args, **kwargs) Overloaded function.

  1. KL_divergence(p: list[float], q: list[float]) -> float

Calculates the Kullback-Leibler (KL) divergence between two discrete probability distributions.

The KL divergence is defined as: \[ \mathrm{KL}(\mathrm{p} \| \mathrm{q})=\sum \mathrm{p}(\mathrm{x}) \log \frac{\mathrm{p}(\mathrm{x})}{\mathrm{q}(\mathrm{x})} \]

Note
The KL divergence is not commutative, i.e., \(\mathrm{KL}(\mathrm{p} \| \mathrm{q}) \neq \mathrm{KL}(\mathrm{q} \| \mathrm{p})\).
Parameters
pA constant reference to the first probability distribution.
qA constant reference to the second probability distribution.
Returns
double The KL divergence between the two distributions.
  1. KL_divergence(p_pdf: Callable[[float], float], q_pdf: Callable[[float], float], x_start: float, x_end: float, dx: float = 0.0001) -> float

Calculates the KL divergence for continuous probability distributions using function pointers.

The KL divergence is given by the formula: \f[ \mathrm{KL}(\mathrm{p} \| \mathrm{q})=\int \mathrm{p}(\mathrm{x}) \log \frac{\mathrm{p}(\mathrm{x})}{\mathrm{q}(\mathrm{x})} \mathrm{dx} \f]

Parameters
p_pdfA pointer to a function representing the probability distribution p(x).
q_pdfA pointer to a function representing the probability distribution q(x).
x_startThe starting point of the integration.
x_endThe end point of the integration.
dxThe step size for the numerical integration (default is 1e-4).
Returns
double The calculated KL divergence.
Note
The KL divergence is not commutative.

◆ KL_divergence() [2/2]

float pyqpanda3.quantum_info.KL_divergence ( list[float] p,
list[float] q )

KL_divergence(*args, **kwargs) Overloaded function.

  1. KL_divergence(p: list[float], q: list[float]) -> float

Calculates the Kullback-Leibler (KL) divergence between two discrete probability distributions.

The KL divergence is defined as: \[ \mathrm{KL}(\mathrm{p} \| \mathrm{q})=\sum \mathrm{p}(\mathrm{x}) \log \frac{\mathrm{p}(\mathrm{x})}{\mathrm{q}(\mathrm{x})} \]

Note
The KL divergence is not commutative, i.e., \(\mathrm{KL}(\mathrm{p} \| \mathrm{q}) \neq \mathrm{KL}(\mathrm{q} \| \mathrm{p})\).
Parameters
pA constant reference to the first probability distribution.
qA constant reference to the second probability distribution.
Returns
double The KL divergence between the two distributions.
  1. KL_divergence(p_pdf: Callable[[float], float], q_pdf: Callable[[float], float], x_start: float, x_end: float, dx: float = 0.0001) -> float

Calculates the KL divergence for continuous probability distributions using function pointers.

The KL divergence is given by the formula: \f[ \mathrm{KL}(\mathrm{p} \| \mathrm{q})=\int \mathrm{p}(\mathrm{x}) \log \frac{\mathrm{p}(\mathrm{x})}{\mathrm{q}(\mathrm{x})} \mathrm{dx} \f]

Parameters
p_pdfA pointer to a function representing the probability distribution p(x).
q_pdfA pointer to a function representing the probability distribution q(x).
x_startThe starting point of the integration.
x_endThe end point of the integration.
dxThe step size for the numerical integration (default is 1e-4).
Returns
double The calculated KL divergence.
Note
The KL divergence is not commutative.