MeasureState - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


QuantumComputing

  

MeasureState

  

measure a quantum state

Calling Sequence
Parameters
Description

Examples
   

Calling Sequence

MeasureState(circuit, state, options)

Parameters

circuit

-

list of equations; The left side of an equation indicates the qubit or qubits on which the operator acts and the right side provides the operator itself.

state

-

polynom or Array; quantum state in Dirac notation (polynom) or as a multidimensional Array (Array)

options

-

The optional keyword dirac can be set to true (default) or false to determine whether the output state is returned in Dirac notation or Array notation.

Description

• 

The MeasureState command accepts a circuit as a list of equations and a quantum state.  

• 

In the circuit the left side of an equation indicates the qubit or qubits on which the operator acts and the right side provides the operator itself.  When the left side of an equation is a single qubit, it should be expressed as an integer, but when the left side represents two or more qubits, it should be expressed as a list of integers.  The right side of an equation can be generated by the Gate command or provided by the user.

• 

The quantum state can be expressed in Dirac notation (polynom) or as a multidimensional Array (Array).    

• 

The MeasureState command returns the expectation value of the circuit, which is a product of the operators in the list, with respect to the given quantum state.

• 

The optional boolean keyword dirac determines whether the output 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.

Examples

First we load the QuantumChemistry package

withQuantumChemistry:

Next we load the QuantumComputing subpackage

withQuantumComputing;

ConvertDirac,Gate,InitialState,MeasureState,PrepareState,QubitPopulations,QubitPopulationsPlot

(1)

We can initialize a state of 4 qubits on our simulated quantum computer with the InitialState command

state0  InitialState4;

state0Ψ0,0,0,0

(2)

The initial wave function has each of its 4 qubits in the lower state of the qubit, denoted by 0.  To illustrate preparing a state on the quantum computer, let's use a product of gates (unitary transformations), known as a circuit, to prepare a Schrodinger cat state in which the state of all qubits down becomes entangled with the state of all qubits up.  In QCT the circuit is readily assemble as a Maple list of equations.  The left side of an equation indicates the qubit or qubits on which the gate acts and the right side provides the gate itself.

circuit  1= GateH,seqi,i+1=GateCNOT, i=1..3;

 

circuit1=22222222,1,2=1000000100100100,2,3=1000000100100100,3,4=1000000100100100

(3)

To prepare the new state, we act on the initial state state0 with our circuit

state2  PrepareStatecircuit,state0;

 

state22Ψ0,0,0,02+2Ψ1,1,1,12

(4)

The new state entangles a state of 4 "down" qubits with a state of 4 "up" qubits.  Like Schrodinger's cat, our state is half up and half down.  We can use the MeasureState command to measure the probability of the first qubit being up (in 1 rather than 0).  First, we assemble the operator to measure up from a combination of the Identity and Pauli-Z gates.

UpOperator  GateIGateZ2;

UpOperator0001

(5)

Second, we measure that operator with respect to state2

 MeasureState1=UpOperator,state2;

12

(6)

 

See Also

QuantumChemistry
QuantumComputing