A basic question on circuits and matrix representationSWAP gate(s) in the $R(lambda^-1)$ step of the HHL circuit for $4times 4$ systemsDecomposition of arbitrary 2 qubit operatorSolving a circuit implementing a two-level unitary operationMatrix representation and CX gateHow to construct matrix of regular and “flipped” 2-qubit CNOT?Square root of CNOT and spectral decomposition of the Hadamard gateMatrix representation of multiple qubit gates (Hadamard transform on single wire)Tensorial notation for this quantum XOR circuitUnderstanding CNOT gate for indirect measurementHow to create an Ising coupling gate with Qiskit
How to foreshadow to avoid a 'deus ex machina'-construction
Just how much information should you share with a former client?
How to prevent a single-element caster from being useless against immune foes?
Why don't short runways use ramps for takeoff?
Scam? Checks via Email
Can hardware wallets actually display the amount of funds leaving your control?
How do I make my photos have more impact?
What clothes would flying-people wear?
Why are subdominants unstable?
My employer is refusing to give me the pay that was advertised after an internal job move
How did astronauts using rovers tell direction without compasses on the Moon?
Reading electrical clamp tester higher voltage/amp 400A
Why raspberry pi 4b claims that it's processor is armv7l when in official specification it's ARM v8? How to change it?
Are all French verb conjugation tenses and moods practical and efficient?
Why did I lose on time with 3 pawns vs Knight. Shouldn't it be a draw?
Is it okay for me to decline a project on ethical grounds?
"DDoouubbllee ssppeeaakk!!"
Avoiding Implicit Conversion in Constructor. Explicit keyword doesn't help here
Can machine learning learn a function like finding maximum from a list?
Efficiently finding furthest two nodes in a graph
How does Asimov's second law deal with contradictory orders from different people?
How close to the Sun would you have to be to hear it?
How do discovery writers hibernate?
Why tantalum for the Hayabusa bullets?
A basic question on circuits and matrix representation
SWAP gate(s) in the $R(lambda^-1)$ step of the HHL circuit for $4times 4$ systemsDecomposition of arbitrary 2 qubit operatorSolving a circuit implementing a two-level unitary operationMatrix representation and CX gateHow to construct matrix of regular and “flipped” 2-qubit CNOT?Square root of CNOT and spectral decomposition of the Hadamard gateMatrix representation of multiple qubit gates (Hadamard transform on single wire)Tensorial notation for this quantum XOR circuitUnderstanding CNOT gate for indirect measurementHow to create an Ising coupling gate with Qiskit
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I have several (rather basic) questions on matrix representation of circuits and I would be very grateful to anyone that could clear up my confusion, thank you in advance.
1) When reading circuit diagrams I know that the input qubit goes in the left hand side. So If we are reading a circuit and it's gates go in the order a,b,c does that mean when we want to write out its matrix representation we multiply the matrices in the order c,a,b . For example if we have a circuit which consists of a swap gate followed by a Hadamard gate on the second qubit , followed by a Hadamard gate on the first qubit , then to calculate it's matrix representation we would have to calculate it in the order $(H_1otimes I)(Iotimes H_2)Swap$, correct ? (as this reflects the order of application of gates on the qubit state).
2)If we are given a gate $S=beginpmatrix1 &0 \0 &i endpmatrix$, but it is on the top line of a two line circuit with a line connecting it to the second (In other words it's a control gate ), I know that the first qubit is the control and the second is the target but I'm unsure of how to write it , should it be $S=beginpmatrix1 & 0 &0&0 \ 0 &-i &0&0\0&0&1&0\0&0&0&-i endpmatrix$,
or should it be
$ S=beginpmatrix1 & 0 &0&0 \ 0 &1 &0&0\0&0&-i&0\0&0&0&-i endpmatrix$,
circuit-construction matrix-representation
$endgroup$
add a comment |
$begingroup$
I have several (rather basic) questions on matrix representation of circuits and I would be very grateful to anyone that could clear up my confusion, thank you in advance.
1) When reading circuit diagrams I know that the input qubit goes in the left hand side. So If we are reading a circuit and it's gates go in the order a,b,c does that mean when we want to write out its matrix representation we multiply the matrices in the order c,a,b . For example if we have a circuit which consists of a swap gate followed by a Hadamard gate on the second qubit , followed by a Hadamard gate on the first qubit , then to calculate it's matrix representation we would have to calculate it in the order $(H_1otimes I)(Iotimes H_2)Swap$, correct ? (as this reflects the order of application of gates on the qubit state).
2)If we are given a gate $S=beginpmatrix1 &0 \0 &i endpmatrix$, but it is on the top line of a two line circuit with a line connecting it to the second (In other words it's a control gate ), I know that the first qubit is the control and the second is the target but I'm unsure of how to write it , should it be $S=beginpmatrix1 & 0 &0&0 \ 0 &-i &0&0\0&0&1&0\0&0&0&-i endpmatrix$,
or should it be
$ S=beginpmatrix1 & 0 &0&0 \ 0 &1 &0&0\0&0&-i&0\0&0&0&-i endpmatrix$,
circuit-construction matrix-representation
$endgroup$
add a comment |
$begingroup$
I have several (rather basic) questions on matrix representation of circuits and I would be very grateful to anyone that could clear up my confusion, thank you in advance.
1) When reading circuit diagrams I know that the input qubit goes in the left hand side. So If we are reading a circuit and it's gates go in the order a,b,c does that mean when we want to write out its matrix representation we multiply the matrices in the order c,a,b . For example if we have a circuit which consists of a swap gate followed by a Hadamard gate on the second qubit , followed by a Hadamard gate on the first qubit , then to calculate it's matrix representation we would have to calculate it in the order $(H_1otimes I)(Iotimes H_2)Swap$, correct ? (as this reflects the order of application of gates on the qubit state).
2)If we are given a gate $S=beginpmatrix1 &0 \0 &i endpmatrix$, but it is on the top line of a two line circuit with a line connecting it to the second (In other words it's a control gate ), I know that the first qubit is the control and the second is the target but I'm unsure of how to write it , should it be $S=beginpmatrix1 & 0 &0&0 \ 0 &-i &0&0\0&0&1&0\0&0&0&-i endpmatrix$,
or should it be
$ S=beginpmatrix1 & 0 &0&0 \ 0 &1 &0&0\0&0&-i&0\0&0&0&-i endpmatrix$,
circuit-construction matrix-representation
$endgroup$
I have several (rather basic) questions on matrix representation of circuits and I would be very grateful to anyone that could clear up my confusion, thank you in advance.
1) When reading circuit diagrams I know that the input qubit goes in the left hand side. So If we are reading a circuit and it's gates go in the order a,b,c does that mean when we want to write out its matrix representation we multiply the matrices in the order c,a,b . For example if we have a circuit which consists of a swap gate followed by a Hadamard gate on the second qubit , followed by a Hadamard gate on the first qubit , then to calculate it's matrix representation we would have to calculate it in the order $(H_1otimes I)(Iotimes H_2)Swap$, correct ? (as this reflects the order of application of gates on the qubit state).
2)If we are given a gate $S=beginpmatrix1 &0 \0 &i endpmatrix$, but it is on the top line of a two line circuit with a line connecting it to the second (In other words it's a control gate ), I know that the first qubit is the control and the second is the target but I'm unsure of how to write it , should it be $S=beginpmatrix1 & 0 &0&0 \ 0 &-i &0&0\0&0&1&0\0&0&0&-i endpmatrix$,
or should it be
$ S=beginpmatrix1 & 0 &0&0 \ 0 &1 &0&0\0&0&-i&0\0&0&0&-i endpmatrix$,
circuit-construction matrix-representation
circuit-construction matrix-representation
asked 8 hours ago
bhapibhapi
3578 bronze badges
3578 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
- Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a "time direction" left to right. As an example the following circuit
implements the operation
$$(Iotimes mathrmCNOT)(mathrmCNOTotimes I)(Hotimes Iotimes I)|000rangle $$
- A controlled gate does nothing if the first qubit is $0$ and performs the gate if it is $1$, you can represent it this way
$$mathrmCS=|0ranglelangle0|otimes I + |1ranglelangle1|otimes S $$
Hence in matrix form it would be
$$mathrmCS=beginpmatrix
I&0\0&S
endpmatrix =beginpmatrix
1&0&0&0\0&1&0&0\0&0&1&0\0&0&0&i
endpmatrix$$
$endgroup$
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "694"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f6907%2fa-basic-question-on-circuits-and-matrix-representation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
- Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a "time direction" left to right. As an example the following circuit
implements the operation
$$(Iotimes mathrmCNOT)(mathrmCNOTotimes I)(Hotimes Iotimes I)|000rangle $$
- A controlled gate does nothing if the first qubit is $0$ and performs the gate if it is $1$, you can represent it this way
$$mathrmCS=|0ranglelangle0|otimes I + |1ranglelangle1|otimes S $$
Hence in matrix form it would be
$$mathrmCS=beginpmatrix
I&0\0&S
endpmatrix =beginpmatrix
1&0&0&0\0&1&0&0\0&0&1&0\0&0&0&i
endpmatrix$$
$endgroup$
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
add a comment |
$begingroup$
- Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a "time direction" left to right. As an example the following circuit
implements the operation
$$(Iotimes mathrmCNOT)(mathrmCNOTotimes I)(Hotimes Iotimes I)|000rangle $$
- A controlled gate does nothing if the first qubit is $0$ and performs the gate if it is $1$, you can represent it this way
$$mathrmCS=|0ranglelangle0|otimes I + |1ranglelangle1|otimes S $$
Hence in matrix form it would be
$$mathrmCS=beginpmatrix
I&0\0&S
endpmatrix =beginpmatrix
1&0&0&0\0&1&0&0\0&0&1&0\0&0&0&i
endpmatrix$$
$endgroup$
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
add a comment |
$begingroup$
- Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a "time direction" left to right. As an example the following circuit
implements the operation
$$(Iotimes mathrmCNOT)(mathrmCNOTotimes I)(Hotimes Iotimes I)|000rangle $$
- A controlled gate does nothing if the first qubit is $0$ and performs the gate if it is $1$, you can represent it this way
$$mathrmCS=|0ranglelangle0|otimes I + |1ranglelangle1|otimes S $$
Hence in matrix form it would be
$$mathrmCS=beginpmatrix
I&0\0&S
endpmatrix =beginpmatrix
1&0&0&0\0&1&0&0\0&0&1&0\0&0&0&i
endpmatrix$$
$endgroup$
- Yes, in the circuit the qubit "enters" to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a "time direction" left to right. As an example the following circuit
implements the operation
$$(Iotimes mathrmCNOT)(mathrmCNOTotimes I)(Hotimes Iotimes I)|000rangle $$
- A controlled gate does nothing if the first qubit is $0$ and performs the gate if it is $1$, you can represent it this way
$$mathrmCS=|0ranglelangle0|otimes I + |1ranglelangle1|otimes S $$
Hence in matrix form it would be
$$mathrmCS=beginpmatrix
I&0\0&S
endpmatrix =beginpmatrix
1&0&0&0\0&1&0&0\0&0&1&0\0&0&0&i
endpmatrix$$
answered 6 hours ago
user2723984user2723984
3158 bronze badges
3158 bronze badges
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
add a comment |
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
$begingroup$
Thank you for succinctly answering all my questions :)
$endgroup$
– bhapi
5 hours ago
add a comment |
Thanks for contributing an answer to Quantum Computing Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f6907%2fa-basic-question-on-circuits-and-matrix-representation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown