Paclet Installation
Paclet Installation
In[]:=
PacletInstall["https://wolfr.am/DevWQCF",ForceVersionInstall->True]<<Wolfram`QuantumFramework`
Out[]=
PacletObject
QuantumCircuitOperator
QuantumCircuitOperator
A quantum circuit is a composition of quantum operators acting on a quantum state, representing a stepwise transformation of a quantum system.
a list of operators (either complete form, or shorthand)
a named circuit
a circuit acting on its corresponding register state
act on a explicit state
QuantumCircuitOperator[{op1,op1,op2}]
QuantumCircuitOperator[{"named_circuit",...}]
QuantumCircuitOperator[...][]
QuantumCircuitOperator[...][state]
In[]:=
Composition[f,g,h]%[x]
Out[]=
f@*g@*h
Out[]=
f[g[h[x]]]
In[]:=
RightComposition[f,g,h]%[x]
Out[]=
f/*g/*h
Out[]=
h[g[f[x]]]
Named Circuits
Named Circuits
In[]:=
QuantumCircuitOperator["Bell"]
Out[]=
In[]:=
QuantumCircuitOperator["Bell"][]
Out[]=
QuantumState
In[]:=
QuantumCircuitOperator["Magic"]
Out[]=
In[]:=
QuantumCircuitOperator["Toffoli"]
Out[]=
QuantumCircuitOperator
In[]:=
QuantumCircuitOperator["Fourier"]
Out[]=
In[]:=
QuantumCircuitOperator["Fourier"]["QuantumOperator"]==QuantumOperator["Fourier",{1,2}]
Out[]=
True
In[]:=
QuantumCircuitOperator[{"Fourier",5}]
Out[]=
In[]:=
QuantumCircuitOperator[{"Fourier",5,3}]
Out[]=
In[]:=
QuantumCircuitOperator[{"InverseFourier",5,3}]
Out[]=
In[]:=
QuantumCircuitOperator[{"Fourier",3}]["Dagger"]
Out[]=
QuantumCircuitOperator
In[]:=
QuantumCircuitOperator[{"PhaseEstimation",QuantumOperator[{"Phase",2π/5}],5}]
Out[]=
In[]:=
QuantumCircuitOperator[{"BernsteinVazirani","101"}]
Out[]=
In[]:=
QuantumCircuitOperator[{"BernsteinVazirani","101"}][]["Probabilities"]
Out[]=
|000〉0,|001〉0,|010〉0,|011〉0,|100〉0,|101〉1,|110〉0,|111〉0
Graph circuit, to generate graph/cluster states
Graph circuit applies CZ on all edges
You may recall that we had a Graph state.
Grover quantum-search algorithm with a Boolean oracle, given a Boolean function
The corresponding Boolean oracle
Note the Boolean oracle saves the solution in an ancillary qubit (last one).
Let’s find the solutions using SatisfiabilityInstances:
Let’s create corresponding quantum states, by adding the last [ancillary] qubit and set it as 0
Now after apply the Boolean oracle, as one can see, the ancillary qubit is flipped
There is another way of saving the solution of a Boolean function: adding a phase into solutions
Create states:
Action of phase oracle on them:
QuantumCircuitOperator
QuantumCircuitOperator
A random unitary applies on only qubit-1
Sqrt-X (also called as V operator) on qubit-2
Depolarizing channel with probability p on qubit-3
Pauli-X on qubit-1, Pauli-Z on qubit-2, Pauli-Y on qubit 3:
Magic circuit, followed by measuring qubits in the computational basis:
SWAP on qubit-1 and 4, and another SWAP on qubit-2 and 3:
A composition of circuits: NOT on qubits 1 through 4, and the QFT on qubits 2,3 and 4:
Bell circuit followed by the bit-flip channel with probability p1 on qubit-1 and p2 on qubit-2