I was wondering if there is a formula to find the sum of all the items in a matrix. The value at each index is (column $XOR$ row). For example, a matrix with 5 rows and 8 columns would be
0 1 2 3 4 5 6 7
1 0 3 2 5 4 7 6
2 3 0 1 6 7 4 5
3 2 1 0 7 6 5 4
4 5 6 7 0 1 2 3
I also need to take away a fixed amount from each of the items in the matrix (keeping each item 0 or above). Making the grid I need to find the sum of:
0 0 1 2 3 4 5 6
0 0 2 1 4 3 6 5
1 2 0 0 5 6 3 4
2 1 0 0 6 5 4 3
3 4 5 6 0 0 1 2