Change of parameters of Gates in quantumCircuit does not take effect
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
James Cai
el 23 de Jun. de 2023
Respondida: Christine Tobler
el 30 de Jun. de 2023
This question concerns MATLAB Support Package for Quantum Computing.
As shown below:
C1=quantumCircuit(ryGate(1,0.5*pi))
C2=C1;
isequal(simulate(C1),simulate(C2))
ans =
logical
1
C2.Gates.Angles=0.25*pi;
isequal(simulate(C1),simulate(C2))
ans =
logical
1
The first comparison should return true, while the second should not.
Any comments?
0 comentarios
Respuesta aceptada
Christine Tobler
el 30 de Jun. de 2023
This is a bug, thank you for reporting it. As a workaround while waiting for this to be addressed, pleaseconstruct a new gate instead of assigning to the angles:
C2.Gates.Angles = 0.25*pi;
use
C2.Gates = ryGate(1, 0.25*pi);
0 comentarios
Más respuestas (1)
Satwik
el 26 de Jun. de 2023
Hi James,
I understand that you are using Quantum computing package's function ryGate to create a y axis rotation gate and when you change the angle of one of the gates you expect the gates to differ but they remain the same.
When you change the angle of the Gates it does not affects the QuantumState of the gate which is what you are comparing when you do simulate(C1).
C1 is a :
quantumCircuit with properties:
NumQubits: 1
Gates: [1×1 quantum.gate.SimpleGate]
Name: ""
whereas simulate(C1) is a :
QuantumState with properties:
BasisStates: [2×1 string]
Amplitudes: [2×1 double]
NumQubits: 1
And QuantumState only depends on the NumQubits of QuantumCircuit, not on the Gates.
So if you do isequal(C1,C2) after changing the angle it will return false. But if you want to change the QuantumState i.e. simulate() you need to change NumQubits.
Please look into the below code for reference.
C2.NumQubits = 2;
isequal(simulate(C1),simulate(C2)); % Will return false
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Gate-Based Quantum Computing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!