Change of parameters of Gates in quantumCircuit does not take effect
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
James Cai
le 23 Juin 2023
Réponse apportée : Christine Tobler
le 30 Juin 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 commentaires
Réponse acceptée
Christine Tobler
le 30 Juin 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 commentaires
Plus de réponses (1)
Satwik
le 26 Juin 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 commentaires
Voir également
Catégories
En savoir plus sur Gate-Based Quantum Computing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!