pik-copan / pyunicorn

Unified Complex Network and Recurrence Analysis Toolbox
http://pik-potsdam.de/~donges/pyunicorn/
Other
195 stars 86 forks source link

MAINT: consistently implement use of type alias `ADJ` for adjacency matrices #184

Open fkuehlein opened 12 months ago

fkuehlein commented 12 months ago

To make use of datatypes more coherent and minimize datatype complications with cython, semantic type aliases for various purposes were defined in pyunicorn.core._ext.types as of 3dab5bf. Currently, in most cases variables are only cast to the respective type alias at the python/cython interface (using pyunicorn.core._ext.types.to_cy()) to keep implementation effort within limited resource bounds at the time.

This specifically concerns the type alias ADJ=np.int8 which is meant for adjacency matrices. The adjacency matrix self.adjacency is a property of the Network class, and is thus inherited by all its child classes.

The dtype of Network.adjacency is set to int16 or int32 in Network._set_adjacency() to avoid overflow in numpy.sparse matrices.

TODO:

See Issue #163 for a previous dicussion on this.