Question:
Question:
Two copies of the ancillary circuit go into the qlscircuit circuit. In the second instance the dagger operator appears to be used to take the ConjugateTranspose operation. However
the “Conjugate” property is also invoked on the ancillary instance with the dagger. This undoes the conjugation. If this is meant here it would have no effect if matrixA is real, but this will not
be the case in general. Some examples are given below. I would think that the desired transformation would include both the complex conjugation of the numbers and the transformation of bra vectors to ket vectors,
but this does not appear to be done here.
the “Conjugate” property is also invoked on the ancillary instance with the dagger. This undoes the conjugation. If this is meant here it would have no effect if matrixA is real, but this will not
be the case in general. Some examples are given below. I would think that the desired transformation would include both the complex conjugation of the numbers and the transformation of bra vectors to ket vectors,
but this does not appear to be done here.
Answer:
Answer:
I will present a step-by-step implementation of a simple example to clearly demonstrate why the transposed ancillary state is used without applying the conjugate.
Problem
Problem
Given the matrix:
M=X+Y
In[]:=
m=QuantumOperator["X"+"Y"]["Matrix"];m//MatrixForm
Out[]//MatrixForm=
0 | 0 |
2 | 0 |
Given the vector:
In[]:=
x={1,0}
Out[]=
{1,0}
The product:
In[]:=
m.x
Out[]=
{0,2}
Multiplexer implementation
Multiplexer implementation
In[]:=
pauliDecompose=QuantumOperator["X"+"Y"]["PauliDecompose"]
Out[]=
X,Y1
In[]:=
mp=QuantumCircuitOperator["Multiplexer"[Sequence@@Keys[pauliDecompose]]];
In[]:=
mp["Formula"]
Out[]=
|00〉〈01|+|01〉〈00|-|10〉〈11|+|11〉〈10|
In[]:=
ancillary=QuantumState[Sqrt@Values[pauliDecompose]]["ComplexExpand"]
Out[]=
1+
2
In[]:=
qc=QuantumCircuitOperatorancillary->1,QuantumState[x,"Label"->"x"]->{2},mp->{1,2},->1;qc["Diagram"]
†
(ancillary["Conjugate"])
Out[]=
Up to this point, everything is similar to the classical case. Let’s compare the resulting products.
In[]:=
qc[]["AmplitudesList"]
Out[]=
{0,2}
In[]:=
m.x
Out[]=
{0,2}
Step-by-Step
Step-by-Step
Initial state:
In[]:=
qc[[;;2]]["Diagram",ImageSize->Tiny]
Out[]=
In[]:=
initial=QuantumTensorProduct[ancillary,QuantumState[x]]
Out[]=
1+
2
First control operator:
In[]:=
mp[[1]]["Formula"]
Out[]=
|00〉〈01|+|01〉〈00|+|10〉〈10|+|11〉〈11|
Apply it to the initial state:
In[]:=
step1=mp[[1]]@initial
Out[]=
1+
2
Second control operator:
In[]:=
mp[[2]]["Formula"]
Out[]=
|00〉〈00|+|01〉〈01|-|10〉〈11|+|11〉〈10|
Apply it:
In[]:=
step2=mp[[2]]@step1
Out[]=
1+
2
Apply the final ancillary:
In[]:=
†
ancillary["Conjugate"]
Out[]=
1+
2
In[]:=
step3=@step2
†
ancillary["Conjugate"]
Out[]=
2|1〉
Compare the solution:
In[]:=
step3["StateVector"]//Normal
Out[]=
{0,2}
In[]:=
m.x
Out[]=
{0,2}
The terms from the final ancillary exactly match those of the regular state, resulting in the correct final outcome. Now, let’s examine the conjugate transpose of the final ancillary and explain why it doesn’t work:
In[]:=
†
ancillary
Out[]=
1-
2
In[]:=
†
ancillary
Out[]=
(1+)|1〉