Low-Overhead Array Striding Interface

Fastmat offers a special C-level interface allowing the creation, processing and manipulation of views into the underlying data of numpy.ndarray objects without the overhead of creating view or memoryview objects of that array object. As the implementation is based on C structures, no interaction with the python object interface is necessary, thus increasing the efficiency of advanced linear operators from within cython code. By mimimizing memory operations occuring during view creation, structure- or object allocation or copying, this helps minimizing the already low overhead on using cython memoryviews further.

The main container for defining and using strides is the STRIDE_s structure:

ctypedef struct STRIDE_s:
    char *          base
    intsize         strideElement
    intsize         strideVector
    intsize         numElements
    intsize         numVectors
    np.uint8_t      sizeItem
    ftype           dtype

fastmat Type Identifier

The striding interface supports:
  • Two-dimensional numpy.ndarray objects
  • Non-contiguous (striding) access into the data
  • Modifying views (substriding