[Qmod core-library function]Initializes a quantum variable in a state corresponding to a given probability distribution:∣out⟩=i=0∑len(probabilities)−1probabilities[i]∣i⟩with i=0,1,2,...,{len(amplitudes)}−1 corresponding to computational basis states.Parameters:
Name
Type
Description
Default
probabilities
CArray[CReal]
The probability distribution to initialize the quantum variable. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Initializes a quantum variable in a state corresponding to the given amplitudes:∣out⟩=i=0∑len(amplitudes)−1amplitudes[i]∣i⟩with i=0,1,2,...,{len(amplitudes)}−1 corresponding to computational basis states.Parameters:
Name
Type
Description
Default
amplitudes
CArray[CReal]
The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |0> to the state per the specified probability distribution
(similar to prepare_state but preformed on an initialized variable).Parameters:
Name
Type
Description
Default
probabilities
CArray[CReal]
The probability distribution corresponding to the quantum variable state. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |0> to the state per the specified amplitudes
(similar to prepare_amplitudes but preformed on an initialized variable).Parameters:
Name
Type
Description
Default
amplitudes
CArray[CReal]
The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |n> to e{iphases[n]}|n> for all n, where |n> are the computational basis states.Parameters:
Name
Type
Description
Default
phases
CArray[CReal]
The phases to rotate the quantum variable. Must be a real vector. Must have a valid length (2 to the power of the number of qubits in the target variable).