QuantumComputing
InitialState
prepare an initial quantum state
Calling Sequence Parameters Description
Examples
Calling Sequence
InitialState(nqubits, options)
Parameters
nqubits
-
posint; positive integer indicating the number of qubits
options
The optional keyword dirac can be set to true (default) or false to determine whether the initial state is returned in Dirac notation or Array notation.
Description
The InitialState command accepts a positive integer indicating the number of qubits.
The InitialState command returns an initial state with all qubits in the lower (or 0) state.
The optional boolean keyword dirac determines whether the initial state is returned in Dirac notation (true) or Array notation (false).
In Dirac notation the number of qubits is represented by the number of indices on the wave function symbol; in Array notation the number of qubits is represented by the number of dimensions of the Array.
The two states of each qubit are denoted as 0 and 1 in Dirac notation; they are represented by the range 1..2 of each dimension in Array notation.
First we load the QuantumChemistry package
with⁡QuantumChemistry:
Next we load the QuantumComputing subpackage
withQuantumComputing;
ConvertDirac,Gate,InitialState,MeasureState,PrepareState,QubitPopulations,QubitPopulationsPlot
We can initialize a state of 4 qubits on our simulated quantum computer with the InitialState command
state0 ≔ InitialState4;
state0≔Ψ0,0,0,0
or using dirac = true, we have
state0 ≔ InitialState4, dirac=false;
See Also
QuantumChemistry QuantumComputing
Download Help Document