moble / spherical_functions

Python/numba package for evaluating Wigner D matrices and spin-weighted spherical harmonics
MIT License
52 stars 11 forks source link

half integer ell #17

Closed moble closed 8 years ago

moble commented 8 years ago

From @gdurkin on January 21, 2016 0:56

So I am using this code to generate Wigner rotation matrices quickly -- but when I rotate a normalized ket with the matrix derived in this way it produces a new ket with the wrong normalization IF the ket is a half integer spin ket, e.g. a qubit or spin 3/2 particle. (everything is fine when the state has integer spin, ell = 1,2,3,..)

am i missing the code for the half-integer case?

Copied from original issue: moble/quaternion#21

moble commented 8 years ago

You're not using this code to generate Wigner rotation matrices. Are you talking about this code?

moble commented 8 years ago

From @gdurkin on January 21, 2016 1:6

Thanks for the quick reply, I was using:

import quaternion
import spherical_functions as sf

def QuaternionRotMat(ell,aa,bb,cc,dd):
    indices = []
    R = np.quaternion(aa,bb,cc,dd).normalized()
    indices = np.array([[ell,mp,m]
                    for mp in np.arange(-ell, ell + 1) for m in np.arange(-ell, ell+ 1)])
    mat = sf.Wigner_D_element(R, indices).reshape((2*ell + 1, 2*ell + 1))
    return mat
moble commented 8 years ago

You're right. I did actually make a note of this failure in the docstring for Wigner_D_element, though it probably should have been more prominent, and I probably should have tested for such input.

In any event, I also say in that docstring that it should be quite simple for me to account for the half-integer case. So I'll work on that. It really shouldn't take too long, but I'll also have to write some tests. Try back tomorrow, and if I haven't got it by then, please bug me about it. This is something I've been meaning to get to for a while now.

Incidentally, Wigner_D_matrices might be easier for you to use.

moble commented 8 years ago

@gdurkin This should be handled now. However, note that I decided to leave Wigner_D_matrices and the SWSH functions as just handling integer values, because I don't think it would be called for very often.

But I've also added spherical_functions.LMpM_range_half_integer. If you're interested in range-like functionality, you can just use that and pass the resulting array into Wigner_D_element. Might be a touch slower than optimal, but I doubt the difference would be worth the effort.

gdurkin commented 8 years ago

awesome, thanks mike... half integer is always useful in quantum information, any time you have a permutation symmetric state of an odd number of qubits or spins or two-level atoms in an atomic ensemble or a two-mode BEC-- these states of highest collective spin are often the interesting ones for quantum metrology or quantum information. Obviously the lower half-integer collective state spaces can also be occupied, J \mapsto (Jmax - 1), (Jmax- 2)

On 22 January 2016 at 11:41, Mike Boyle notifications@github.com wrote:

@gdurkin https://github.com/gdurkin This should be handled now. However, note that I decided to leave Wigner_D_matrices and the SWSH functions as just handling integer values, because I don't think it would be called for very often.

But I've also added spherical_functions.LMpM_range_half_integer. If you're interested in range-like functionality, you can just use that and pass the resulting array into Wigner_D_element. Might be a touch slower than optimal, but I doubt the difference would be worth the effort.

— Reply to this email directly or view it on GitHub https://github.com/moble/spherical_functions/issues/17#issuecomment-174023049 .

Dr. Gabriel A. Durkin, Senior Research Scientist SGT, Inc. and Quantum Artificial Intelligence Laboratory (QuAIL) at NASA Ames Research Center Moffett Field CA 94035 USA Tel: +1 626 993 4132 Email: gabriel.durkin@qubit.org Web: http://www.nas.nasa.gov/quantum/durkin.html http://www.nasa.gov/centers/ames/research/qpl/durkin-index.html NASA QFT 1.0 Conference: http://quantum.nasa.gov