Comments (7)
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.
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.
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.
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.
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.
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.
Thanks Andrew!
from scaffcc.
Related Issues (20)
- Changing compiler syntax/core HOT 3
- [Algorithms] How to solve the NP-complete problem for Register Allocation?
- [PASS] FlattenModule generated 6837+K sha1.n12812.inlined.ll
- GPL-free HOT 1
- Ground State Estimation
- Publish Dockerfile HOT 7
- Wrong QASM output for Teleportation circuit HOT 2
- Segmentation fault when generating QASM when file contains `cbit c = MeasZ(q);`
- Segmentation fault when assigning several cbit values
- -o is not working for QFT HOT 5
- Can't find math.h and other headers HOT 1
- ScaffCC does not compile with Python 3.4, but does with Python 2.7 HOT 2
- ScaffCC does not compile with C++11
- Building braidflash is not working
- Specification on nisq benchmark adder HOT 2
- Version not alligned HOT 1
- About the CTQG part in the paper HOT 2
- CMake Error HOT 17
- Toffoli decomposition not working (?) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scaffcc.