Opened 9 years ago
Last modified 8 years ago
#10895 needs_work enhancement
add qitensor spkg (tensors for quantum information)
Reported by: | dstahlke | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | packages: optional | Keywords: | quantum spkg tensor sd35.5 |
Cc: | schilly, fbissey, jason | Merged in: | |
Authors: | Dan Stahlke | Reviewers: | Paul Zimmermann |
Report Upstream: | N/A | Work issues: | various issues to fix |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
I've worked up a python module and an associated spkg that basically wraps numpy in a way that makes it useful for doing finite-dimensional quantum mechanics over several particles. In particular, this should be useful for quantum information. The features that are currently available more or less reflect what I have needed in order to do the things that I am currently working on. More information is available on the project's web page, linked below.
The module is available from: http://www.stahlke.org/dan/qitensor/
This package works in python and in Sage. In Sage it is possible to create arrays (or tensors if you wish to call it that) over SR (or in fact any commutative ring).
The git repo contains both the python and the spkg sources and is the "main" source. The tarballs and spkg are built from that.
Attachments (7)
Change History (16)
Changed 9 years ago by
comment:1 Changed 9 years ago by
- Cc fbissey added
comment:2 Changed 8 years ago by
- Cc jason added
comment:3 Changed 8 years ago by
Are you wanting this to be an optional spkg for Sage? Is it ready to be reviewed? (If so, then change the ticket status to needs_review.) Or would you work on the package more before going through the review process?
comment:4 Changed 8 years ago by
- Status changed from new to needs_review
Yes, it is ready for review. I have been posting new versions here as I've been adding features, but I believe it to be bug-free and in a usable state. I envision this as an optional package since probably few users of Sage are working in the field of quantum information. Also, it can be used independently of Sage and for that reason perhaps is best not being a built-in package (although I don't know the official criteria for built-in vs. optional).
comment:5 Changed 8 years ago by
- Description modified (diff)
comment:6 follow-up: ↓ 7 Changed 8 years ago by
- Keywords sd35.5 added
- Status changed from needs_review to needs_work
- Work issues set to documentation to fix
I installed successfully the package (0.8) on top of sage-4.8.alpha6. However the documentation of
qubit
says:
... See also: "qudit()", "indexed_space()"
but:
sage: qudit() --------------------------------------------------------------------------- NameError Traceback (most recent call last) /tmp/sage-4.8.alpha6/<ipython console> in <module>() NameError: name 'qudit' is not defined sage: indexed_space() --------------------------------------------------------------------------- NameError Traceback (most recent call last) /tmp/sage-4.8.alpha6/<ipython console> in <module>() NameError: name 'indexed_space' is not defined
Paul Zimmermann
comment:7 in reply to: ↑ 6 Changed 8 years ago by
- Status changed from needs_work to needs_review
Replying to zimmerma:
sage: qudit()
NameError? Traceback (most recent call last)
/tmp/sage-4.8.alpha6/<ipython console> in <module>()
NameError?: name 'qudit' is not defined
Paul,
You need to first do "from qitensor import *". If the spkg is supposed to import itself automatically, then I don't know how to make that happen (and can't see anything about that in the sage documentation). On my box the qudit() function works if I first import:
sage: from qitensor import * sage: qudit() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/dstahlke/<ipython console> in <module>() TypeError: qudit() takes at least 2 arguments (0 given)
- Dan
comment:8 Changed 8 years ago by
- Reviewers set to Paul Zimmermann
- Status changed from needs_review to needs_work
- Work issues changed from documentation to fix to various issues to fix
thanks Dan. A few comments:
- the SPKG.txt file only mentions version 0.1, not version 0.8
- the documentation on http://www.stahlke.org/dan/qitensor/doc/index.html is for Python, not for
Sage. In particular the output we get from Sage is different, for example:
sage: from qitensor import qubit sage: ha = qubit('a') sage: hb = qubit('b') sage: (ha * hb).array() |a,b> [0] [0] [-] [0] [0]
which differs from the first example in http://www.stahlke.org/dan/qitensor/doc/examples/slices.html
- you have added a 3rd item (c) in the original 2-clause BSD license, with the consequence that it is no longer a 2-clause BSD license. Please fix that.
- I tried the tests and some of them failed (with sage-4.8.alpha6):
The following tests failed: sage -t "qitensor-0.8/src/qitensor/array.py" sage -t "qitensor-0.8/src/qitensor/atom.py" sage -t "qitensor-0.8/src/qitensor/circuit.py" sage -t "qitensor-0.8/src/qitensor/space.py" Total time for all tests: 38.5 seconds
- finally some documentation and doctests are missing (here for
circuit.py
):tiramisu% ../../../sage -coverage circuit.py ---------------------------------------------------------------------- circuit.py SCORE circuit.py: 0% (0 of 3) Missing doctests: * cphase(h1, h2): * cnot(h1, h2): * max_entangled(h1, h2):
Paul Zimmermann
comment:9 Changed 8 years ago by
Paul,
Most of the issues you raise are due to qitensor using Sage's matrix display function in Sage and numpy's display function when in python. This causes the doctest results to be different. I suppose the solution would be to either always use numpy's display function (which isn't as nice) or to write my own display function. I'll have to think this over, feel free to make suggestions.
The other items you list are easy to fix and I'll get on that as soon as I have some free time.
Thanks, Dan
spkg