posted 18 years ago
Dear all,
I have a matrix of the following form.
Ex:
1 0 0 0 1 0 1 1 0 1 1
0 0 0 1 0 1 0 1 1 1 0
1 1 1 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 1
1 0 0 1 1 0 0 0 0 0 1
1 1 1 0 0 0 1 0 0 0 0
I have to search in this matrix a submatrix(A) of the form
0 1 1
0 0 1
0 0 0. and the program should give the output:i) Total no.of submatrix present in the main matrix and ii)row and column elements forming the submatrix in the main matrix.
For Ex: in the above example we can find the submatrix for R4,R5,R6&C9,C10,C11
THe search must take into consideration the combinations all the rows and colums.i.e.,the rows and colums are not only consecutive but also the program should compare submatrix(A) with the submatrix from the main matrix using the combination like row1,2,5& column 1,2,4 and so on.......
I havenot done any programming like this before where I can compare a submatrix with a main matrix. I have written the program using if and for loops and that worked out pretty well, but for my file it took almost 1day to run since there were many loops.
So please suggest me for generating the code and how to proceed with the programming.
THanx in advance.