Is there a library (in any language) that can search patterns in matrixes like regular expressions work for strings ? Something like regular expresions for matrixes, or any matrix pattern search method ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re not averse to using J, you can find out whether two matrices are equal by using the
-:(match) operator. For example:One nice feature of the match operator is that you can use it to compare arrays of arbitrary dimension; if
Ais a 3x3x4 array andBis a 2×1 array, thenA-:Breturns0.To find out whether a matrix is a submatrix of another matrix, you can use the
E:(member of interval) operator like so:The 1 at the top left of the result signifies that the part of Y that is equal to X has the given pixel as its upper left-hand corner. The reason for this is that there may be several overlapping copies of X embedded in Y, and only flagging the one pixel lets you see the location of every matching tile.