Expose more testing functions via cython api.
This commit is contained in:
parent
dca04153f2
commit
0315481977
|
@ -693,7 +693,7 @@ cdef class ScatteringSystem:
|
|||
self.s, iri, 0)
|
||||
return target_np
|
||||
|
||||
def pack_matrix(self, fullmatrix, iri):
|
||||
def pack_matrix(self, fullmatrix, iri, version='normal'):
|
||||
"""Converts (projects) a matrix into an irrep subspace.
|
||||
|
||||
Parameters
|
||||
|
@ -725,10 +725,14 @@ cdef class ScatteringSystem:
|
|||
cdef np.ndarray[np.complex_t, ndim=2] target_np = np.empty(
|
||||
(rlen, rlen), dtype=complex, order='C')
|
||||
cdef cdouble[:,::1] target_view = target_np
|
||||
qpms_scatsys_irrep_pack_matrix(&target_view[0][0], &fullmatrix_view[0][0],
|
||||
if version == 'stupid':
|
||||
qpms_scatsys_irrep_pack_matrix_stupid(&target_view[0][0], &fullmatrix_view[0][0],
|
||||
self.s, iri)
|
||||
else:
|
||||
qpms_scatsys_irrep_pack_matrix(&target_view[0][0], &fullmatrix_view[0][0],
|
||||
self.s, iri)
|
||||
return target_np
|
||||
def unpack_matrix(self, packedmatrix, iri):
|
||||
def unpack_matrix(self, packedmatrix, iri, version='normal'):
|
||||
"""Unpacks an "irrep-packed" excitation coefficient vector to full coordinates.
|
||||
|
||||
Parameters
|
||||
|
@ -761,7 +765,11 @@ cdef class ScatteringSystem:
|
|||
cdef np.ndarray[np.complex_t, ndim=2] target_np = np.empty(
|
||||
(flen, flen), dtype=complex, order='C')
|
||||
cdef cdouble[:,::1] target_view = target_np
|
||||
qpms_scatsys_irrep_unpack_matrix(&target_view[0][0], &packedmatrix_view[0][0],
|
||||
if version == 'stupid':
|
||||
qpms_scatsys_irrep_unpack_matrix_stupid(&target_view[0][0], &packedmatrix_view[0][0],
|
||||
self.s, iri, 0)
|
||||
else:
|
||||
qpms_scatsys_irrep_unpack_matrix(&target_view[0][0], &packedmatrix_view[0][0],
|
||||
self.s, iri, 0)
|
||||
return target_np
|
||||
|
||||
|
@ -813,6 +821,16 @@ cdef class ScatteringSystem:
|
|||
qpms_scatsys_periodic_build_translation_matrix_full(&target_view[0][0], self.s, wavenumber, &blochvector_c, eta)
|
||||
return target
|
||||
|
||||
def irrep_transform_matrix(self, qpms_iri_t iri):
|
||||
self.check_s()
|
||||
cdef size_t rlen = self.saecv_sizes[iri]
|
||||
cdef size_t fullen = self.fecv_size
|
||||
cdef np.ndarray[np.complex_t, ndim=2] target = np.empty(
|
||||
(rlen, fullen), dtype=complex, order='C')
|
||||
cdef cdouble[:,::1] target_view = target
|
||||
qpms_scatsys_irrep_transform_matrix(&target_view[0][0], self.s, iri)
|
||||
return target
|
||||
|
||||
def translation_matrix_packed(self, cdouble wavenumber, qpms_iri_t iri, J = QPMS_HANKEL_PLUS):
|
||||
self.check_s()
|
||||
cdef size_t rlen = self.saecv_sizes[iri]
|
||||
|
|
|
@ -642,6 +642,11 @@ cdef extern from "scatsystem.h":
|
|||
cdouble omega, const qpms_tolerance_spec_t *tol)
|
||||
qpms_scatsys_at_omega_t *qpms_scatsys_at_omega(const qpms_scatsys_t *ss, cdouble omega)
|
||||
void qpms_scatsys_at_omega_free(qpms_scatsys_at_omega_t *ssw)
|
||||
cdouble *qpms_scatsys_irrep_transform_matrix(cdouble *target, const qpms_scatsys_t *ss, qpms_iri_t iri)
|
||||
cdouble *qpms_scatsys_irrep_pack_matrix_stupid(cdouble *target_packed,
|
||||
const cdouble *orig_full, const qpms_scatsys_t *ss, qpms_iri_t iri)
|
||||
cdouble *qpms_scatsys_irrep_unpack_matrix_stupid(cdouble *target_full,
|
||||
const cdouble *orig_packed, const qpms_scatsys_t *ss, qpms_iri_t iri, bint add)
|
||||
cdouble *qpms_scatsys_irrep_pack_matrix(cdouble *target_packed,
|
||||
const cdouble *orig_full, const qpms_scatsys_t *ss, qpms_iri_t iri)
|
||||
cdouble *qpms_scatsys_irrep_unpack_matrix(cdouble *target_full,
|
||||
|
|
Loading…
Reference in New Issue