Commit 5541cd0e authored by Christoph Groth's avatar Christoph Groth

factor out cdef definitions into operator.pxd

This allows subclassing of operators by third party libraries
(e.g. tkwant).
parent def984b7
Pipeline #15451 passed with stages
in 39 minutes and 39 seconds
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
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment