is there a fast way to extract horizontal, vertical, diagonal, anti-diagonal edges in python each of which must be a separate matrix I do it in this manner seem to be slow