22
Reply

How to find all the sub square matrices of this matrix

aakash malhotra

aakash malhotra

Sep 12 2008 10:11 AM
10.3k
I have a 300*300 matrix. I want to find all the sub square matrices of this matrix such that all the elements of each matrix have the same value.

For eg: Consider a matrix

1 4 5 6 7 8 5 3 4
3 7 7 9 4 2 2 2 5
8 7 7 8 5 3 2 2 1
6 6 7 8 6 3 1 2 3
6 6 8 3 1 1 4 9 0
3 3 3 6 1 1 2 2 0
3 3 3 4 5 6 0 9 1
3 3 3 4 5 6 2 1 0

so the sub matrix with all equal values are 7 7  3 3 3  6 6  1 1  2 2
  7 7  3 3 3  6 6  1 1  2 2
  3 3 3

Can anyone give me some idea how to do this in C#

Answers (22)