207 lines
9.2 KiB
Plaintext
207 lines
9.2 KiB
Plaintext
---
|
||
title: UnivariateDistribution (v0.31)
|
||
description: API reference for qiskit.aqua.components.uncertainty_models.UnivariateDistribution in qiskit v0.31
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.aqua.components.uncertainty_models.UnivariateDistribution
|
||
---
|
||
|
||
# UnivariateDistribution
|
||
|
||
<Class id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/components/uncertainty_models/univariate_distribution.py" signature="UnivariateDistribution(num_target_qubits, probabilities=None, low=0, high=1)" modifiers="class">
|
||
Bases: `qiskit.aqua.components.uncertainty_models.uncertainty_model.UncertaintyModel`, `abc.ABC`
|
||
|
||
This module contains the definition of a base class for univariate distributions. (Interface for discrete bounded uncertainty models assuming an equidistant grid)
|
||
|
||
**Parameters**
|
||
|
||
* **num\_target\_qubits** (`int`) – Number of qubits it acts on, has a min. value of 1.
|
||
* **probabilities** (`Union`\[`List`\[`float`], `ndarray`, `None`]) – Probabilities for different states
|
||
* **low** (`float`) – Lower bound, i.e., the value corresponding to |0…0> (assuming an equidistant grid)
|
||
* **high** (`float`) – Upper bound, i.e., the value corresponding to |1…1> (assuming an equidistant grid)
|
||
|
||
**Raises**
|
||
|
||
[**AquaError**](qiskit.aqua.AquaError "qiskit.aqua.AquaError") – num qubits and length of probabilities vector do not match
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build" />
|
||
|
||
### build
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build" signature="UnivariateDistribution.build(qc, q, q_ancillas=None, params=None)" />
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-controlled" />
|
||
|
||
### build\_controlled
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_controlled" signature="UnivariateDistribution.build_controlled(qc, q, q_control, q_ancillas=None, use_basis_gates=True)">
|
||
Adds corresponding controlled sub-circuit to given circuit
|
||
|
||
**Parameters**
|
||
|
||
* **qc** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – quantum circuit
|
||
* **q** (*list*) – list of qubits (has to be same length as self.\_num\_qubits)
|
||
* **q\_control** ([*Qubit*](qiskit.circuit.Qubit "qiskit.circuit.Qubit")) – control qubit
|
||
* **q\_ancillas** (*list*) – list of ancilla qubits (or None if none needed)
|
||
* **use\_basis\_gates** (*bool*) – use basis gates for expansion of controlled circuit
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-controlled-inverse" />
|
||
|
||
### build\_controlled\_inverse
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_controlled_inverse" signature="UnivariateDistribution.build_controlled_inverse(qc, q, q_control, q_ancillas=None, use_basis_gates=True)">
|
||
Adds controlled inverse of corresponding sub-circuit to given circuit
|
||
|
||
**Parameters**
|
||
|
||
* **qc** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – quantum circuit
|
||
* **q** (*list*) – list of qubits (has to be same length as self.\_num\_qubits)
|
||
* **q\_control** ([*Qubit*](qiskit.circuit.Qubit "qiskit.circuit.Qubit")) – control qubit
|
||
* **q\_ancillas** (*list*) – list of ancilla qubits (or None if none needed)
|
||
* **use\_basis\_gates** (*bool*) – use basis gates for expansion of controlled circuit
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-controlled-inverse-power" />
|
||
|
||
### build\_controlled\_inverse\_power
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_controlled_inverse_power" signature="UnivariateDistribution.build_controlled_inverse_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)">
|
||
Adds controlled, inverse, power of corresponding circuit. May be overridden if a more efficient implementation is possible
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-controlled-power" />
|
||
|
||
### build\_controlled\_power
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_controlled_power" signature="UnivariateDistribution.build_controlled_power(qc, q, q_control, power, q_ancillas=None, use_basis_gates=True)">
|
||
Adds controlled power of corresponding circuit. May be overridden if a more efficient implementation is possible
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-inverse" />
|
||
|
||
### build\_inverse
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_inverse" signature="UnivariateDistribution.build_inverse(qc, q, q_ancillas=None)">
|
||
Adds inverse of corresponding sub-circuit to given circuit
|
||
|
||
**Parameters**
|
||
|
||
* **qc** ([*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – quantum circuit
|
||
* **q** (*list*) – list of qubits (has to be same length as self.\_num\_qubits)
|
||
* **q\_ancillas** (*list*) – list of ancilla qubits (or None if none needed)
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-inverse-power" />
|
||
|
||
### build\_inverse\_power
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_inverse_power" signature="UnivariateDistribution.build_inverse_power(qc, q, power, q_ancillas=None)">
|
||
Adds inverse power of corresponding circuit. May be overridden if a more efficient implementation is possible
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-build-power" />
|
||
|
||
### build\_power
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.build_power" signature="UnivariateDistribution.build_power(qc, q, power, q_ancillas=None)">
|
||
Adds power of corresponding circuit. May be overridden if a more efficient implementation is possible
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-get-num-qubits" />
|
||
|
||
### get\_num\_qubits
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.get_num_qubits" signature="UnivariateDistribution.get_num_qubits()">
|
||
returns number of qubits
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-get-num-qubits-controlled" />
|
||
|
||
### get\_num\_qubits\_controlled
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.get_num_qubits_controlled" signature="UnivariateDistribution.get_num_qubits_controlled()">
|
||
returns number of qubits controlled
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-pdf-to-probabilities" />
|
||
|
||
### pdf\_to\_probabilities
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.pdf_to_probabilities" signature="UnivariateDistribution.pdf_to_probabilities(pdf, low, high, num_values)" modifiers="static">
|
||
Takes a probability density function (pdf), and returns a truncated and discretized array of probabilities corresponding to it
|
||
|
||
**Parameters**
|
||
|
||
* **pdf** (*function*) – probability density function
|
||
* **low** (*float*) – lower bound of equidistant grid
|
||
* **high** (*float*) – upper bound of equidistant grid
|
||
* **num\_values** (*int*) – number of grid points
|
||
|
||
**Returns**
|
||
|
||
array of probabilities
|
||
|
||
**Return type**
|
||
|
||
list
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-required-ancillas" />
|
||
|
||
### required\_ancillas
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.required_ancillas" signature="UnivariateDistribution.required_ancillas()">
|
||
returns required ancillas
|
||
</Function>
|
||
|
||
<span id="qiskit-aqua-components-uncertainty-models-univariatedistribution-required-ancillas-controlled" />
|
||
|
||
### required\_ancillas\_controlled
|
||
|
||
<Function id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.required_ancillas_controlled" signature="UnivariateDistribution.required_ancillas_controlled()">
|
||
returns required ancillas controlled
|
||
</Function>
|
||
|
||
## Attributes
|
||
|
||
### high
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.high">
|
||
returns high
|
||
</Attribute>
|
||
|
||
### low
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.low">
|
||
returns low
|
||
</Attribute>
|
||
|
||
### num\_target\_qubits
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.num_target_qubits">
|
||
Returns the number of target qubits
|
||
</Attribute>
|
||
|
||
### num\_values
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.num_values">
|
||
returns number of values
|
||
</Attribute>
|
||
|
||
### probabilities
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.probabilities">
|
||
returns probabilities
|
||
</Attribute>
|
||
|
||
### values
|
||
|
||
<Attribute id="qiskit.aqua.components.uncertainty_models.UnivariateDistribution.values">
|
||
returns values
|
||
</Attribute>
|
||
</Class>
|
||
|