change the boundary type and use Array<T,4> instead Matrix2D