diff --git a/kwant/operator.pxd b/kwant/operator.pxd new file mode 100644 index 0000000000000000000000000000000000000000..c443b0d9c63f9c1d0da4c56626ea2f29bbc7c389 --- /dev/null +++ b/kwant/operator.pxd @@ -0,0 +1,48 @@ +from .graph.defs cimport gint +from .graph.defs import gint_dtype + + +cdef gint _bisect(gint[:] a, gint x) + +cdef int _is_herm_conj(complex[:, :] a, complex[:, :] b, + double atol=*, double rtol=*) except -1 + +cdef int _check_onsite(complex[:, :] M, gint norbs, + int check_hermiticity) except -1 + +cdef int _check_ham(complex[:, :] H, ham, args, params, + gint a, gint a_norbs, gint b, gint b_norbs, + int check_hermiticity) except -1 + +cdef void _get_orbs(gint[:, :] site_ranges, gint site, + gint *start_orb, gint *norbs) + + +cdef class BlockSparseMatrix: + cdef public gint[:, :] block_offsets, block_shapes + cdef public gint[:] data_offsets + cdef public complex[:] data + + cdef complex* get(self, gint block_idx) + + +cdef class _LocalOperator: + cdef public int check_hermiticity, sum + cdef public object syst, onsite, _onsite_param_names + cdef public gint[:, :] where, _site_ranges + cdef public BlockSparseMatrix _bound_onsite, _bound_hamiltonian + + cdef BlockSparseMatrix _eval_onsites(self, args, params) + cdef BlockSparseMatrix _eval_hamiltonian(self, args, params) + + +cdef class Density(_LocalOperator): + pass + + +cdef class Current(_LocalOperator): + pass + + +cdef class Source(_LocalOperator): + pass diff --git a/kwant/operator.pyx b/kwant/operator.pyx index 002eb8b66e188aa95a44b3e5c6248187dfaa6319..8421ba56df78d8718cf421e71ab0c09a6a1f4744 100644 --- a/kwant/operator.pyx +++ b/kwant/operator.pyx @@ -335,10 +335,6 @@ cdef class BlockSparseMatrix: The matrix of each block, stored in row-major (C) order. """ - cdef public gint[:, :] block_offsets, block_shapes - cdef public gint[:] data_offsets - cdef public complex[:] data - @cython.embedsignature @cython.boundscheck(False) @cython.wraparound(False) @@ -401,7 +397,8 @@ ctypedef enum operation: cdef class _LocalOperator: - """Base class for operators defined by an on-site matrix and the Hamiltonian. + """Base class for operators defined by an on-site matrix and the + Hamiltonian. This includes "true" local operators, as well as "currents" and "sources". @@ -431,11 +428,6 @@ cdef class _LocalOperator: `~kwant.operator._LocalOperator.__call__` for details). """ - cdef public int check_hermiticity, sum - cdef public object syst, onsite, _onsite_param_names - cdef public gint[:, :] where, _site_ranges - cdef public BlockSparseMatrix _bound_onsite, _bound_hamiltonian - @cython.embedsignature def __init__(self, syst, onsite, where, *, check_hermiticity=True, sum=False):