I have a very large 3D matrix and I need to call some specific patterns with a special configuration from this large matrix. For example, I need a sub-matrixes which their a,b,c,..,h element are equal with a specific value (it is not pattern matching, but I need some patterns that have a specific value)
Is there any solution to find them very fast? One solution, as I know, is to scan the matrix and store its pattern in a database and then use PCA to reducing the size of database, but I am looking for a more accurate method.
For example, suppose that I have a matrix such as I:
I=[1 0 0 1 0 1 0 1 0
0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 0 1 0
1 0 1 1 0 1 0 1 0
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 1 0 0
0 0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0 1
0 0 1 0 0 0 0 1 0]
then I have another matrix as below:
p=[1 0 NaN NaN 1 NaN NaN NaN NaN]
then, I should look in "I" to find the rows which their column 1,2 and 5 is equal to 1,0,1 respectively (in this example, row of 6 is the correct row. But, in the reality, the size of my matrix (I) is very huge (more than billion) and if I use a loop to find those rows, it need a lot of time. I am looking for a fast code or method. Hope it be meaningful now!