first search diagonal
ported numpy arrays to cython