Is it possible to expand/merge different circuits?
$begingroup$
Suppose I have created a circuit composed of some registers with the usual
qc = QuantumCircuit(qr, cr)
where qr
and cr
are a quantum register and a classical register respectively.
Now, suppose that at this point I want to invoke a subroutine. This subroutine, however, uses some ancillas. Is there any functions to append this new set of qubits to the original circuit? Something like
ancillas = QuantumRegister(n, 'ancillas')
#qc.append(ancillas)
An equivalent problem (maybe) is the following one. Suppose I have a quantum circuit qcn
composed of n
qubits and a subroutine which returns another quantum circuit qck
operating on k
qubits, with k > n
. Is it possible to compose the two circuits in such a way that the first n
qubits on which the subroutine operates are the same of the original circuit?
At the moment, the only solution to me seems to declare in advance all the total number of qubits required (k
in the previous case) and then passing around them to the various functions.
programming qiskit ibm-q-experience
$endgroup$
add a comment |
$begingroup$
Suppose I have created a circuit composed of some registers with the usual
qc = QuantumCircuit(qr, cr)
where qr
and cr
are a quantum register and a classical register respectively.
Now, suppose that at this point I want to invoke a subroutine. This subroutine, however, uses some ancillas. Is there any functions to append this new set of qubits to the original circuit? Something like
ancillas = QuantumRegister(n, 'ancillas')
#qc.append(ancillas)
An equivalent problem (maybe) is the following one. Suppose I have a quantum circuit qcn
composed of n
qubits and a subroutine which returns another quantum circuit qck
operating on k
qubits, with k > n
. Is it possible to compose the two circuits in such a way that the first n
qubits on which the subroutine operates are the same of the original circuit?
At the moment, the only solution to me seems to declare in advance all the total number of qubits required (k
in the previous case) and then passing around them to the various functions.
programming qiskit ibm-q-experience
$endgroup$
add a comment |
$begingroup$
Suppose I have created a circuit composed of some registers with the usual
qc = QuantumCircuit(qr, cr)
where qr
and cr
are a quantum register and a classical register respectively.
Now, suppose that at this point I want to invoke a subroutine. This subroutine, however, uses some ancillas. Is there any functions to append this new set of qubits to the original circuit? Something like
ancillas = QuantumRegister(n, 'ancillas')
#qc.append(ancillas)
An equivalent problem (maybe) is the following one. Suppose I have a quantum circuit qcn
composed of n
qubits and a subroutine which returns another quantum circuit qck
operating on k
qubits, with k > n
. Is it possible to compose the two circuits in such a way that the first n
qubits on which the subroutine operates are the same of the original circuit?
At the moment, the only solution to me seems to declare in advance all the total number of qubits required (k
in the previous case) and then passing around them to the various functions.
programming qiskit ibm-q-experience
$endgroup$
Suppose I have created a circuit composed of some registers with the usual
qc = QuantumCircuit(qr, cr)
where qr
and cr
are a quantum register and a classical register respectively.
Now, suppose that at this point I want to invoke a subroutine. This subroutine, however, uses some ancillas. Is there any functions to append this new set of qubits to the original circuit? Something like
ancillas = QuantumRegister(n, 'ancillas')
#qc.append(ancillas)
An equivalent problem (maybe) is the following one. Suppose I have a quantum circuit qcn
composed of n
qubits and a subroutine which returns another quantum circuit qck
operating on k
qubits, with k > n
. Is it possible to compose the two circuits in such a way that the first n
qubits on which the subroutine operates are the same of the original circuit?
At the moment, the only solution to me seems to declare in advance all the total number of qubits required (k
in the previous case) and then passing around them to the various functions.
programming qiskit ibm-q-experience
programming qiskit ibm-q-experience
edited Dec 10 '18 at 4:18
Blue♦
6,15831354
6,15831354
asked Dec 9 '18 at 21:06
tigerjack89tigerjack89
2308
2308
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
For the first question, you can use
qc.add(ancillas)
Note that this will change to add_registers
in Qiskit Terra 0.7.0.
Some more guidance on how to combine and extend circuits, you can see this guide. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with
pip install git+https://github.com/Qiskit/qiskit-terra.git
$endgroup$
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
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%2f4897%2fis-it-possible-to-expand-merge-different-circuits%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$
For the first question, you can use
qc.add(ancillas)
Note that this will change to add_registers
in Qiskit Terra 0.7.0.
Some more guidance on how to combine and extend circuits, you can see this guide. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with
pip install git+https://github.com/Qiskit/qiskit-terra.git
$endgroup$
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
add a comment |
$begingroup$
For the first question, you can use
qc.add(ancillas)
Note that this will change to add_registers
in Qiskit Terra 0.7.0.
Some more guidance on how to combine and extend circuits, you can see this guide. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with
pip install git+https://github.com/Qiskit/qiskit-terra.git
$endgroup$
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
add a comment |
$begingroup$
For the first question, you can use
qc.add(ancillas)
Note that this will change to add_registers
in Qiskit Terra 0.7.0.
Some more guidance on how to combine and extend circuits, you can see this guide. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with
pip install git+https://github.com/Qiskit/qiskit-terra.git
$endgroup$
For the first question, you can use
qc.add(ancillas)
Note that this will change to add_registers
in Qiskit Terra 0.7.0.
Some more guidance on how to combine and extend circuits, you can see this guide. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with
pip install git+https://github.com/Qiskit/qiskit-terra.git
answered Dec 9 '18 at 21:58
James WoottonJames Wootton
6,5071944
6,5071944
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
add a comment |
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
$begingroup$
Thanks, just what I needed. Btw, there are any planes on when the 0.7.0 version will be officially out? Together with a list of major breaks wrt the 0.6 version.
$endgroup$
– tigerjack89
Dec 9 '18 at 22:45
1
1
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
$begingroup$
I think it should be out in the next few weeks, but the holidays may lead to a slight delay. The 0.7 releases shouldn't differ too much from the 0.6 releases. They'll mainly differ to the integration of some tools from outside of Terra.
$endgroup$
– James Wootton
Dec 10 '18 at 10:58
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%2f4897%2fis-it-possible-to-expand-merge-different-circuits%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