Thanks a lot Mr. Stein. Finally, I could successfully integrate it with my existing installation.
On Dec 24, 12:04 pm, "William Stein" <wst...@gmail.com> wrote: > On Tue, Dec 23, 2008 at 10:04 PM, vivek <freewill1...@gmail.com> wrote: > > > Hi > > > Thanks a lot for your prompt reply. > > > But I wasn't able to install qasm spkg. > > I tried the following > > (1) attempted to install dvipng package, i couldn't install it as > > well. > > Do not install that dvipng spkg. You *MUST* install dvipng instead > using whatever method your operating system provides (e.g., rpm, deb, > etc.). It's a completely standard linux program. The Sage dvipng > spkg will be deleted soon, since it doesn't make sense for us to be > hosting it. > > -- William > > > > > (2) attempted to install after sage -sh > > but both failed. > > > Please find below the install-log report > > > qasm-1.4 > > Machine: > > Linux freewill 2.6.18-6-686 #1 SMP Tue Jun 17 21:31:27 UTC 2008 i686 > > GNU/Linux > > Deleting directories from past builds of previous/current versions of > > qasm-1.4 > > Extracting package /home/ram/sage/qasm-1.4.spkg ... > > -rwxr-xr-x 1 ram ram 14572 2008-12-23 19:21 /home/ram/sage/ > > qasm-1.4.spkg > > qasm-1.4/ > > qasm-1.4/setup.py > > qasm-1.4/qasm/ > > qasm-1.4/qasm/qasm.py > > qasm-1.4/qasm/__init__.py > > qasm-1.4/SPKG.txt > > qasm-1.4/.hgignore > > qasm-1.4/.hg/ > > qasm-1.4/.hg/dirstate > > qasm-1.4/.hg/store/ > > qasm-1.4/.hg/store/00changelog.i > > qasm-1.4/.hg/store/00manifest.i > > qasm-1.4/.hg/store/undo > > qasm-1.4/.hg/store/data/ > > qasm-1.4/.hg/store/data/qasm/ > > qasm-1.4/.hg/store/data/qasm/____init____.py.i > > qasm-1.4/.hg/store/data/qasm/qasm.py.i > > qasm-1.4/.hg/store/data/_s_p_k_g.txt.i > > qasm-1.4/.hg/store/data/.hgignore.i > > qasm-1.4/.hg/store/data/spkg-install.i > > qasm-1.4/.hg/store/data/setup.py.i > > qasm-1.4/.hg/00changelog.i > > qasm-1.4/.hg/undo.dirstate > > qasm-1.4/.hg/requires > > qasm-1.4/spkg-install > > qasm-1.4/src/ > > qasm-1.4/src/CHANGES > > qasm-1.4/src/qasm2tex.py > > qasm-1.4/src/xyqcirc.tex > > qasm-1.4/src/README > > Finished extraction > > **************************************************** > > Host system > > uname -a: > > Linux freewill 2.6.18-6-686 #1 SMP Tue Jun 17 21:31:27 UTC 2008 i686 > > GNU/Linux > > **************************************************** > > **************************************************** > > GCC Version > > gcc -v > > Using built-in specs. > > Target: i486-linux-gnu > > Configured with: ../src/configure -v --enable-languages=c,c+ > > +,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with- > > system-zlib --libexecdir=/usr/lib --without-included-gettext --enable- > > threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit > > --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with- > > tune=i686 --enable-checking=release i486-linux-gnu > > Thread model: posix > > gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) > > **************************************************** > > You must make sure the dvipng program is available on your system. > > You might be able to install the dvipng program listed in the > > output of 'sage -optional'. If that doesn't work, just use whatever > > is offered by your operating system. > > > real 0m0.011s > > user 0m0.000s > > sys 0m0.012s > > sage: An error occurred while installing qasm-1.4 > > Please email sage-develhttp://groups.google.com/group/sage-devel > > explaining the problem and send the relevant part of > > of /home/ram/sage/sage-3.1.4/install.log. Describe your computer, > > operating system, etc. > > If you want to try to fix the problem, yourself *don't* just cd to > > /home/ram/sage/sage-3.1.4/spkg/build/qasm-1.4 and type 'make'. > > Instead type "/home/ram/sage/sage-3.1.4/sage -sh" > > in order to set all environment variables correctly, then cd to > > /home/ram/sage/sage-3.1.4/spkg/build/qasm-1.4 > > (When you are done debugging, you can type "exit" to leave the > > subshell.) > > > Kindly help me to resolve this issue. > > > Thanking you. > > > On Dec 23, 12:36 pm, "William Stein" <wst...@gmail.com> wrote: > >> On Mon, Dec 22, 2008 at 9:55 PM, vivek <freewill1...@gmail.com> wrote: > > >> > Hi > > >> > I know of a python script by name qasm2circ (http://www.media.mit.edu/ > >> > quanta/qasm2circ/). > > >> > This script takes a description of a quantum-circuit (called a QASM > >> > file) and converts it into a graphical depiction. This is done using > >> > latex (specifically xypic) to produce high-quality output in epsf, > >> > pdf, or png formats. > > >> > However, I want to integrate this script with sage, so that I can draw > >> > the figures right in the sage notebook like I draw other 2d or 3d > >> > plots. > > >> > I would deeply thankful if someone gives me some hint, about how I can > >> > go about doing this. > > >> OK, so I've done this. > > >> 1. I've attached a screenshot of using what I've done from the sage > >> notebook. I've published the relevant worksheet with examples here: > > >> http://sagenb.org/home/pub/118/ > > >> I've also pasted the text version of this worksheet below. I've > >> installed qasm-1.4 into sagenb.org, so if you go there you can just > >> use it. > > >> 2. To use qasm from Sage, you have to install the optional qasm spkg. > >> You can do this by typing > > >> sage -i qasm-1.4 > > >> I've also attached the qasm-1.4 spkg to this email, though you can > >> ignore that. It's tiny, by the way (only 15K). It's very important > >> that you have latex installed of course, or qasm won't work. > > >> That's it. Let me know if you have any problems. > > >> qasm > >> system:sage > > >> {{{id=0| > >> from qasm import qasm > >> /// > > >> }}} > > >> {{{id=4| > >> qasm(""" > >> qubit q0 > >> qubit q1 > > >> h q0 # create EPR pair > >> cnot q0,q1 > >> """) > >> /// > > >> }}} > > >> {{{id=1| > >> %qasm > > >> 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 > >> nop j2 > >> h j1 > >> c-S j2,j1 > >> h j2 > >> swap j0,j2 > >> /// > > >> }}} > > >> {{{id=2| > >> %qasm > > >> # > >> # File: test9.qasm > >> # Date: 22-Mar-04 > >> # Author: I. Chuang > >> # > >> # Sample qasm input file - two-qubit gate circuit > >> # implementation of Toffoli > > >> def c-X,1,'\sqrt{X}' > >> def c-Xd,1,'{\sqrt{X}}^\dagger' > > >> qubit q0 > >> qubit q1 > >> qubit q2 > > >> c-X q1,q2 > >> cnot q0,q1 > >> c-Xd q1,q2 > >> cnot q0,q1 > >> c-X q0,q2 > >> /// > > >> }}} > > >> Picture 2.png > >> 81KViewDownload > > >> qasm-1.4.spkg > >> 19KViewDownload > > -- > William Stein > Associate Professor of Mathematics > University of Washingtonhttp://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---