Quantum Computing Asked by VittorioC on October 4, 2021
Can someone suggest me a way to load a distribution (for example a discretized Gaussian distribution) into a quantum computer using a quantum circuit?
I tried to implement the code using Qiskit.
Several quantum circuit representations for common distributions are given in uncertainty models. For generic probability distributions, you can train a quantum circuit representation using quantum generative adversarial networks. For a respective tutorial, please see here.
Answered by Christa Zoufal on October 4, 2021
There are practical examples in Qiskit on how to use common probability distributions with uncertainty models. Let us refer to the following example from Qiskit-AQUA (Algorithms for QUantum computing Applications) on using amplitude estimation algorithm to evaluate a fixed income asset with uncertain interest rates.
import numpy as np
from qiskit import BasicAer
from qiskit.aqua.algorithms import AmplitudeEstimation
from qiskit.aqua.components.uncertainty_models import MultivariateNormalDistribution
from qiskit.finance.components.uncertainty_problems import FixedIncomeExpectedValue
# Create a suitable multivariate distribution
mvnd = MultivariateNormalDistribution(num_qubits=[2, 2],
low=[0, 0], high=[0.12, 0.24],
mu=[0.12, 0.24], sigma=0.01 * np.eye(2))
# Create fixed income component
fixed_income = FixedIncomeExpectedValue(mvnd, np.eye(2), np.zeros(2),
cash_flow=[1.0, 2.0], c_approx=0.125)
# Set number of evaluation qubits (samples)
num_eval_qubits = 5
# Construct and run amplitude estimation
algo = AmplitudeEstimation(num_eval_qubits, fixed_income)
result = algo.run(BasicAer.get_backend('statevector_simulator'))
print('Estimated value:t%.4f' % result['estimation'])
print('Probability: t%.4f' % result['max_probability'])
Answered by Gokul Alex on October 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP