Write a program or function where a matrix A (maximum value of dimensions of the matrix is 100) is transformed to a new matrix B. Each element of the new matrix B is the sum of the positive neighbors of the corresponding element of the matrix A.
Only neighbors in the four orthogonal directions are considered, and the edges do not wrap around.
Example input:
1 2 3
4 -1 -2
-3 -4 10
1 2 10
Output:
6 4 2
1 6 13
5 12 10
2 11 12
Rules:
- As input use integers.
- This is a code-golf, so the shortest code in bytes wins.