Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the MCX gate using WCFLOBDD backend #7

Open
s-jobra opened this issue May 3, 2024 · 2 comments
Open

Issue with the MCX gate using WCFLOBDD backend #7

s-jobra opened this issue May 3, 2024 · 2 comments

Comments

@s-jobra
Copy link

s-jobra commented May 3, 2024

Hi,
there seems to be some issue with using the MCX gate with the WCFLOBDD backend.
For example, when I run

#include <unordered_map>
#include <string>
#include "quantum_circuit.h"

#define N_SHOTS 1024

int main()
{
    WeightedCFLOBDDQuantumCircuit qc;

    qc.setNumQubits(3);

    qc.ApplyNOTGate(0);
    qc.ApplyNOTGate(1);
    std::vector<long int> controllers = {0, 1};
    qc.ApplyMCXGate(controllers, 2);

    std::unordered_map<std::string, int> measureResults;
    for(int i = 0; i < N_SHOTS; i++) {
        measureResults[qc.Measure()]++;
    }
    for(const auto& pair : measureResults) {
        std::cout << " '" << pair.first << "' : " << pair.second << std::endl;
    }
}

it produces

 '110' : 1024`

when the expected result is '111'. I'm assuming this is because the method WeightedCFLOBDDQuantumCircuit::ApplyMCXGate is defined, however the body of this method is empty.

@cs14b052
Copy link
Collaborator

cs14b052 commented May 3, 2024

Hi,

Yes. Some gates have not been implemented yet for the WCFLOBDD backend. I plan to do them in the next few weeks. I will at least add "NotImplementedException" so this output doesn't happen.

Please feel free to do it if you want to take a stab at it. However, it might take a few days atleast for me to get to this.

@s-jobra
Copy link
Author

s-jobra commented May 3, 2024

Sure, and thanks! I'll see if I can get to it. I just wanted to let you know because I wasn't sure whether it is intentional or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants