K (ngn/k)K (ngn/k), 2324 bytes
{x+x&2{++/'3'0'3':0,x,0}/~x}
uses 0 1 2 for "AB+"
{ } function with argument x
~ logical not
2{ }/ twice do
0,x,0surround with 0-s (top and bottom of the matrix)3':triples of consecutive rows+/'sum each+transpose
x& logical and of x with
x+ add x to