Coder Social home page Coder Social logo

Comments (5)

Roland-djee avatar Roland-djee commented on July 17, 2024

Hi @boschmitt , I'd be happy to use that functionality. Any updates on this ?

from tweedledum.

boschmitt avatar boschmitt commented on July 17, 2024

Hi @Roland-djee.

There is already some limited support for OpenQASM 2.0.

I suppose the further support would require bigger architectural changes to tweedledum, i.e., possibly creating a AST and a global context capable of handling various circuits inside a bigger program. Also, there is the newer OpenQASM 3.0 version that is still in development phase.

from tweedledum.

Roland-djee avatar Roland-djee commented on July 17, 2024

Yes, concretely, I would like to use the Exorcism implementation. However, it requires input esops as strings (unless I missed something) which can be produced by traversing an AST of some sort. I was wondering if there were already such a functionality for OpenQASM format.

from tweedledum.

boschmitt avatar boschmitt commented on July 17, 2024

exorcism works form an ESOP defined as a vector of cubes or from a truth table.

If you have a function: f(abc) = a!c ⊕ abc, then your ESOP will be [Cube(‘1-0’), Cube(‘111’)]
(Note that ‘b’ does not appear in the first cube, hence the use of ‘-‘)

For example (from python):

from tweedledum.classical import TruthTable, Cube, create_from_cubes, exorcism

esop = [Cube('101'), Cube('100'), Cube('011'), Cube('001'), Cube('000')]
opt_esop = exorcism(esop, 3)
for cube in opt_esop:
    print(cube.to_string(3))

# Create a TruthTable from the orginal ESOP:
tt_esop = TruthTable(3)
create_from_cubes(tt_esop, esop, True)

# Create a TruthTable from the optimized orginal ESOP:
tt_opt_esop = TruthTable(3)
create_from_cubes(tt_opt_esop, opt_esop, True)

# Make sure they are the same
print(tt_esop == tt_opt_esop)

# Now, from a function TruthTable do exorcism (it will extract a PKRM and then do exorcism)
opt_esop_2 = exorcism(tt_opt_esop)
for cube in opt_esop_2:
    print(cube.to_string(3))

from tweedledum.

Roland-djee avatar Roland-djee commented on July 17, 2024

Hi @boschmitt thanks. Yes, I am aware of this. I am just scratching my head around how to parse structures (ie. circuits) to generate these vectors of cubes. It looks like there is no other way than an AST of some sort.

from tweedledum.

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.