Fantastic! On Thu, Jul 18, 2013 at 12:20 PM, Rick Muller <[email protected]> wrote: > I created a new branch in my fork that contains the start of a qasm parser. > If you're interested in this, it's available at: > > https://github.com/rpmuller/sympy/blob/qasm_parser/sympy/physics/quantum/qasm.py > > Right now it doesn't do all that much. I plan to add a few more gates > (X_pi/2, Z_pi/2, S, T), at which point the functionality we have should be > basically useful. > > However, the big thing missing is the ability to define a gate in qasm using > the 'def' command. Example 4 from Chuang's page is: > > def c-S,1,'S' > > def c-T,1,'T' > > qubit j0 > > qubit j1 > > qubit j2 > > h j0 > > c-S j1,j0 > > c-T j2,j0 > > nop j1 > > h j1 > > c-S j2,j1 > > h j2 > > swap j0,j2 > > > We can make gates on the fly by defining a new class, e.g. > > > > > > > class VGate(OneQubitGate): > gate_name = 'V' > gate_name_latex = u'V' > > class SqrtX(OneQubitGate): > gate_name = 'sqrt-X' > gate_name_latex = u'\sqrt{X}' > > > But I don't know how do define a function that does this, without defining > arguments or modifying the object after creation, both of which I understand > are forbidden in sympy operators. > > > Any thoughts? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > >
-- Brian E. Granger Cal Poly State University, San Luis Obispo [email protected] and [email protected] -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
