Expose more testing functions via cython api.
This commit is contained in:
parent
fed391b20c
commit
2c12d28c70
|
@ -696,7 +696,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
|
||||
|
@ -728,10 +728,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
|
||||
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
|
||||
|
@ -764,6 +768,10 @@ 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
|
||||
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
|
||||
|
@ -816,6 +824,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]
|
||||
|
|
|
@ -645,6 +645,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