Introducing my problem with an example: I have a numpy matrix
1 . . 1 . . 1 . . 1 A = . . 1 . 1 1 . . 1 . . 1 1 . 1
whe