Suppose A =(aij) nxn and A = ( Bpq ) where each B is a mxm matrix and m divides n. If n= m x N, then p and q run from 1 to N. Let i = m. I + s and j = m.J + t , then aij = (s, t) entry if s >0 or t >0 else s= m or t = m of BI+1, J+1 Block matrix.
firstly you must calculate the size of the main matrix A(r,c). Then calculate the number of the possible small matrices.Then by programming the solution is proposed by generating two nested loops, one for the external matrix (variable j) and the other for the internal matrices (variable k).