View on GitHub
Open this notebook in GitHub to run it yourself
prepare_state
Parameters:
-
probabilities: CArray[CReal] - Probabilities to load.
-
bound: CReal - Approximation Error Bound, in the metric (with respect to the given probabilies vector).
-
out: Output[QArray[QBit]]
inplace_prepare_state
Parameters:
-
probabilities: CArray[CReal] -
bound: CReal -
out: QArray[QBit] - Should of size exactly (“probabilities.len`)
inplace_prepare_state works the same, but for a given allocated QArray.
Function: prepare_amplitudes
Parameters:
-
amplitudes: CArray[CReal] - Amplitudes of the loaded state.
-
bound: CReal - Approximation Error Bound, in the metric (with respect to the given amplitudes vector).
-
out: Output[QArray[QBit]]
inplace_prepare_amplitudes
Parameters:
-
amplitudes: CArray[CReal] - Amplitudes of the loaded state.
-
bound: CReal - Approximation Error Bound, in the metric (with respect to the given amplitudes vector).
-
out: QArray[QBit] -
Should of size exactly (
amplitudes.len)
inplace_prepare_amplitudes works the same, but for a given allocated QArray.
Example 1: Loading Point Mass (PMF) Function
This example generates a quantum program whose output state probabilities are an approximation to the PMF given. That is, the probability of measuring the state is , is ,… , and the probability to measure is .Output:
Example 2
- Preparating Amplitudes
- The load state has an accuracy of 99 present under the L2 norm.
Output: