Closed GoogleCodeExporter closed 8 years ago
Original comment by nonhermitian
on 19 Nov 2012 at 2:44
I did the necessary modification to the code. Now it uses gmpy2 library.
Performance is much lower than the original version, however it is much faster
than my first implementation with mpmath.
One can use it by importing the file (first install gmpy2 and all necessary
libraries):
sys.path.append('/path to the file')
from wigner_gmpy2 import *
and now just call the function
wigner_precise_gmpy2(psi, xvec, yvec, g=sqrt(2), ddp=100)
ddp is the precision in bits, the standard double precision is 53 bits.
Original comment by D.Vutshi
on 23 Nov 2012 at 2:53
Attachments:
Thank you for letting us know about this issue. I will add the code you sent to
the new plugins page that we are making for the QuTiP website. At some point I
might add support for the mpmath module into the QuTiP Wigner function, however
I am not aware of many people having an use for such a feature given that the
goal is usually to get a small number of quanta.
Original comment by nonhermitian
on 27 Nov 2012 at 1:51
mpmath is so slow that it is close to useless in this case. In my tests it
takes about 5-10 minutes to calculate Wigner function for 20x20 points and
Ndim=30 with mpmath. It takes the same time for gmpy2 implementation to produce
Wigner function for 100x100 points Ndim=100. Mpmath would take hours in this
case. Now I think that the best solution would be to use the fast arbitrary
precision libraries (MPFR and MPC) directly from Cython or Fortran via f2py.
Also a good compromise would be to use a fast quad precision library from C or
Fortran.
Original comment by D.Vutshi
on 27 Nov 2012 at 9:40
mpmath will automatically detect gmpy, if it exists, and use it in its
calculations. Your current suggestions seems like a bit too much work for
addressing the current problem. Programming in mpmath, and using the parfor
function, should be a good enough solution for anyone who runs into this
particular problem provided they are not asking for too high a precision. If
someone needs a specialty tool for calculating these things a lot, then perhaps
your method is the way to go. I am currently writing the Laguerre based Wigner
function in mpmath and have already added the option to run it in parallel.
Hopefully, this will be good enough for now.
Original comment by nonhermitian
on 5 Dec 2012 at 5:25
This issue has been addressed by adding an FFT based Wigner method that does
not use special functions. This is available in the development version on
github.
Original comment by nonhermitian
on 11 Jul 2013 at 2:06
Original issue reported on code.google.com by
D.Vutshi
on 15 Nov 2012 at 10:15Attachments: