Git Product home page Git Product logo

Comments (7)

AndrewLitteken avatar AndrewLitteken commented on June 8, 2024

A CNOT gate is a built in primitive into Scaffold, so if it is only that aspect of controlled gates, I would recommend just using that. The syntax is CNOT(control, target)

If you're asking about implementing controlled gates in Scaffold in general, you cannot use if statements on a quantum bit at present. The generated code will be what you experienced, essentially the body being generated. This is due to the fact that when you're designing a circuit in Scaffold, having a structure like

if (q[0] == 1) {
  X(q[1]);
  Y(q[1]);
}

has a lot of edge cases and design decisions that are hard to grapple with, and haven't been dealt with yet. The best solution is to create modules that contain decompositions of the gates you need. So, I'm sorry for any inconvenience on that front.

The CTQG code has since been removed from Scaffold, however there are builtin functions that deal with addition, and swapping. You can see what these all are if you look in this test.

To simulate the generated code, I'd recommend generating OpenQASM code (-b in the compilation script) and passing to that to a simple Python script that uses Qiskit to read in the OpenQASM and run it in a simulator. You can look in the nisq_benchmarks for example code doing that.

from scaffcc.

kgi-github avatar kgi-github commented on June 8, 2024

Hi,

Thanks for your helpful reply. The cnot was just an example, I'm hoping to compile more substantial classical logic into quantum gates. Do you know of anything out there that does this, or at least compiles into reversible gates?

from scaffcc.

kgi-github avatar kgi-github commented on June 8, 2024

Hi again,
May I ask why the CTQG code was removed? If it's usable, is it possible to get a copy of it?
cheers,
Kevin.

from scaffcc.

AndrewLitteken avatar AndrewLitteken commented on June 8, 2024

RQKC, another project in EPiQC should have CTGQ capabilities. It was removed from Scaffold due to permissions for open sourcing the original code, RKQC is a different implementation of this.

from scaffcc.

kgi-github avatar kgi-github commented on June 8, 2024

Thanks Andrew. I am trying to build RKQC, but it's not straightforward as it is 4 years old and some dependencies are missing. However from the documentation it doesn't look like it will cope with my c-not program, in particular none of the documents or examples show an if statement on a quantum bit. Do you know if it supports this? Also, what became of the CTGQ code (even if it isn't open source)?

from scaffcc.

AndrewLitteken avatar AndrewLitteken commented on June 8, 2024

I'm not really familiar with RKQC, I am really only familiar with the most recent release of Scaffold. The CTGQ code was removed in a prior commit. If you want to try, you can go back and clone the repository at an older point to try to find it. I don't think that will do what you want with a conditional on a qubit either. I'm not really aware of any programs that could directly translate a a structure like that to QASM.

from scaffcc.

kgi-github avatar kgi-github commented on June 8, 2024

Thanks Andrew!

from scaffcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.