I am trying to find the count of diagonal 1s in each 3x3 tile e.g.
0 0 1 1 0 0 1 1 1 0 1 1
0 1 0 0 1 0 1 1 1 0 1 0
1 0 0 or 0 0 1 or 1 1 1 or 1 0 0
just for example where it doesn't matter about the other values in the 3x3 tile just the diagonals. By diagonals I mean the main diagonals as well as the reverse main diagonals. For example the following matrix would output 3 diagonals,
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
I am reading in a list of matrices...
set.seed(1234)
mat1 <- matrix(sample(c(0,1), 225, prob=c(0.8,0.2), replace=TRUE), nrow = 15)
set.seed(99)
mat2 <- matrix(sample(c(0,1), 225, prob=c(0.8,0.2), replace=TRUE), nrow = 15)
set.seed(123)
mat3 <- matrix(sample(c(0,1), 225, prob=c(0.8,0.2), replace=TRUE), nrow = 15)
mat_list <- list(mat1, mat2, mat3)
Any suggestions as to how this could be done?