I would like to create an operation that checks if the elements of the row are 0 and eliminate the respective row and column associated with the row matrix. If if the lines have at least one non-zero element, then the matrix is copied as is. See figure below Suppose I have a list of matrices that increases in size, as for example
list={{{0, 0}, {1, 0}}, {{1, 1, 1}, {0, 1, 0}, {1, 1, 1}}, {{0, 0, 0,
0}, {1, 0, 1, 1}, {1, 0, 0, 1}, {0, 1, 1, 0}}, {{0, 1, 1, 1,
1}, {1, 0, 0, 1, 0}, {0, 1, 0, 1, 1}, {1, 1, 0, 0, 1}, {0, 1, 1, 1,
0}}, {{0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 1,
0}, {1, 1, 1, 0, 0, 0}, {0, 1, 0, 0, 0, 1}, {0, 1, 0, 0, 1,
0}}, {{0, 1, 0, 1, 0, 0, 1}, {1, 0, 0, 0, 0, 1, 0}, {1, 0, 0, 0, 0,
0, 0}, {0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 1, 0, 0, 1}, {0, 0, 0, 1,
1, 0, 1}, {0, 0, 1, 0, 0, 0, 0}}, {{0, 0, 0, 0, 0, 0, 1, 1}, {1, 0,
0, 1, 1, 0, 1, 1}, {0, 1, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0,
0}, {0, 1, 0, 1, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 1,
0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}}, {{0, 0, 1, 1, 0, 0, 0,
0, 0}, {1, 0, 0, 0, 0, 1, 1, 1, 0}, {1, 1, 0, 0, 0, 1, 0, 0,
0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 1, 0, 0, 1}, {0,
0, 0, 0, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 1, 1, 0, 1, 0}, {0, 0, 0, 0,
0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}}, {{0, 0, 1, 0, 1,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