Concatenate Quantum Registers
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
I suggest there should be a function that allows to merge quantum registers.
With the current features of cudaq one, for instance, can do the following:
__qpu__ void myFucntion(cudaq::qview<> qc)
{
cudaq::qview<> qc_1 = qc.front(qc.size()-1);
cudaq::qubit &q = qc[qc.size()-1];
DoSomething(qc_1,q);
}
namely I can separate a quantum register. However I cannot merge quantum registers. This can be very useful when one has numerous quantum functions which handle the input registers differently. Suppose I have a function that works as follows:
__qpu__ void Func1(cudaq::qview<> qc)
{
cudaq::x(qc);
}
Then I have another function that takes as input two quantum registers. Inside this function I want to apply Func1() to both the two registers together. In this case there is not, to my knowledge, a possibility to merge the two input quantum registers and apply the other function to the register which is the result of the merge. What I would liike to do is:
__qpu__ void Func2(cudaq::qview<> qc_1, cudaq::qview<> qc_2)
{
cudaq::y(qc_1);
cudaq::qview<> qc_merge = cudaq::concatenate(qc_1,qc_2);
Func1(qc_merge);
}
Is there the option to do so? If yes what is it? If not, it would be nice to have it.
Best regards!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing cudaq::qview interface, especially the qc.front(qc.size()-1) usage shown in the issue, and check whether register-combination support already exists. Define and validate the behavior needed for concatenating qc_1 and qc_2 so Func1(qc_merge) can operate on the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- quantum-computing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100