Change of parameters of Gates in quantumCircuit does not take effect
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Christine Tobler
2023년 6월 30일
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
추가 답변 (1개)
Satwik
2023년 6월 26일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Gate-Based Quantum Computing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!