I’m wondering if there’s an efficient way to return all of the elements in a matrix that are diagonal to some starting point. For example, given the following matrix:

```
julia> A = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16]
4×4 Array{Int64,2}:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
```

If I want to query the matrix to return all elements that are diagonal to the number 7 (so `A[2,3]`

), I should get back `[2, 12, 4, 10, 13]`

. If I query the matrix at point `A[4,4]`

(where 16 is), I would want to get back `[1,6,11]`

.

Is there a package that already does something like this or is this going to take a custom function?

EDIT: The matrices that I need this for will always be square