LogNormalDistribution#
- class LogNormalDistribution(num_qubits, mu=None, sigma=None, bounds=None, upto_diag=False, name='P(X)')[source]#
Bases:
QuantumCircuit
A circuit to encode a discretized log-normal distribution in qubit amplitudes.
A random variable
is log-normal distributed iffor a normal distribution
. The probability density function of the log-normal distribution is defined asNote
The parameter
sigma
in this class equals the variance, and not the standard deviation. This is for consistency with multivariate distributions, where the uppercase sigma, , is associated with the covariance.This circuit considers the discretized version of
on2 ** num_qubits
equidistant points, , truncated tobounds
. The action of this circuit can be written aswhere
is num_qubits.Note
The circuit loads the square root of the probabilities into the qubit amplitudes such that the sampling probability, which is the square of the amplitude, equals the probability of the distribution.
This circuit is for example used in amplitude estimation applications, such as finance [1, 2], where customer demand or the return of a portfolio could be modeled using a log-normal distribution.
Examples
This class can be used for both univariate and multivariate distributions.
>>> from qiskit_finance.circuit.library.probability_distributions import LogNormalDistribution >>> mu = [1, 0.9, 0.2] >>> sigma = [[1, -0.2, 0.2], [-0.2, 1, 0.4], [0.2, 0.4, 1]] >>> circuit = LogNormalDistribution([2, 2, 2], mu, sigma) >>> circuit.num_qubits 6
References
- [1]: Gacon, J., Zoufal, C., & Woerner, S. (2020).
Quantum-Enhanced Simulation-Based Optimization. arXiv:2005.10780
- [2]: Woerner, S., & Egger, D. J. (2018).
Quantum Risk Analysis. arXiv:1806.06893
- Parameters:
num_qubits (int | List[int]) – The number of qubits used to discretize the random variable. For a 1d random variable,
num_qubits
is an integer, for multiple dimensions a list of integers indicating the number of qubits to use in each dimension.mu (float | List[float] | None) – The parameter
of the distribution. Can be either a float for a 1d random variable or a list of floats for a higher dimensional random variable.sigma (float | List[float] | None) – The parameter
or , which is the variance or covariance matrix.bounds (Tuple[float, float] | List[Tuple[float, float]] | None) – The truncation bounds of the distribution as tuples. For multiple dimensions,
bounds
is a list of tuples[(low0, high0), (low1, high1), ...]
. IfNone
, the bounds are set to(0, 1)
for each dimension.upto_diag (bool) – If True, load the square root of the probabilities up to multiplication with a diagonal for a more efficient circuit.
name (str) – The name of the circuit.
Attributes
- bounds#
Return the bounds of the probability distribution.
- probabilities#
Return the sampling probabilities for the values.
- values#
Return the discretized points of the random variable.
Methods