irot3 to uvswf matrix
Former-commit-id: cb59876dbdaae144913422b73a121cb48cfd9984
This commit is contained in:
parent
9785327445
commit
d4ae25ff81
|
@ -664,7 +664,7 @@ cdef class basespec:
|
|||
if 'norm' in kwargs.keys():
|
||||
self.s.norm = kwargs['norm']
|
||||
else:
|
||||
self.s.norm = QPMS_NORMALISATION_UNDEF
|
||||
self.s.norm = QPMS_NORMALISATION_POWER
|
||||
# set the other metadata
|
||||
cdef qpms_l_t l
|
||||
cdef qpms_m_t m
|
||||
|
@ -707,18 +707,27 @@ cdef class basespec:
|
|||
def l(self): # ugly
|
||||
return self.tlm()[1]
|
||||
|
||||
def __len__(self):
|
||||
return self.s.n
|
||||
|
||||
def __getitem__(self, key):
|
||||
# TODO raise correct errors (TypeError on bad type of key, IndexError on exceeding index)
|
||||
return self.__ilist[key]
|
||||
|
||||
property ilist:
|
||||
def __get__(self):
|
||||
return self.__ilist
|
||||
|
||||
property rawpointer:
|
||||
cdef qpms_vswf_set_spec_t *rawpointer(basespec self):
|
||||
'''Pointer to the qpms_vswf_set_spec_t structure.
|
||||
Don't forget to reference the basespec object itself!!!
|
||||
Don't forget to reference the basespec object itself when storing the pointer anywhere!!!
|
||||
'''
|
||||
return &(self.s)
|
||||
|
||||
property rawpointer:
|
||||
def __get__(self):
|
||||
return <uintptr_t> &(self.s)
|
||||
|
||||
|
||||
# Quaternions from wigner.h
|
||||
# (mainly for testing; use moble's quaternions in python)
|
||||
|
||||
|
@ -1002,6 +1011,17 @@ cdef class irot3:
|
|||
r.rot = cquat(math.cos(math.pi/n),0,0,math.sin(math.pi/n))
|
||||
return r
|
||||
|
||||
def as_uvswf_matrix(irot3 self, basespec bspec):
|
||||
'''
|
||||
Returns the uvswf representation of the current transform as a numpy array
|
||||
'''
|
||||
cdef ssize_t sz = len(bspec)
|
||||
cdef np.ndarray m = np.empty((sz, sz), dtype=complex, order='C') # FIXME explicit dtype
|
||||
cdef cdouble[:, ::1] view = m
|
||||
qpms_irot3_uvswfi_dense(&view[0,0], bspec.rawpointer(), self.qd)
|
||||
return m
|
||||
|
||||
|
||||
def tlm2uvswfi(t, l, m):
|
||||
''' TODO doc
|
||||
'''
|
||||
|
|
|
@ -195,7 +195,7 @@ complex double *qpms_irot3_uvswfi_dense(
|
|||
qpms_l_t cl;
|
||||
qpms_m_t cm;
|
||||
if(qpms_uvswfi2tmn(bspec->ilist[col], &ct, &cm, &cl)) abort();
|
||||
if (rl == cl && rm == cm && rt == ct)
|
||||
if (rl == cl && rt == ct)
|
||||
// TODO qpms_vswf_irot_elem_from_irot3 might be slow and not too accurate for large l
|
||||
target[n*row + col] = // Checkme rm and cm order
|
||||
qpms_vswf_irot_elem_from_irot3(t,
|
||||
|
|
1
setup.py
1
setup.py
|
@ -22,6 +22,7 @@ qpms_c = Extension('qpms_c',
|
|||
'qpms/gaunt.c',#'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
|
||||
# FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
|
||||
'qpms/translations.c',
|
||||
'qpms/symmetries.c',
|
||||
'qpms/wigner.c'],
|
||||
extra_compile_args=['-std=c99','-ggdb', '-O0',
|
||||
'-DQPMS_COMPILE_PYTHON_EXTENSIONS', # this is required
|
||||
|
|
Loading…
Reference in New Issue