# comparing two matrices cell-by-cell, plane-by-plane

Hello

i’m tearing my hairs over a problem, possibly a bug…

I’m trying to compare 2 matrices, find if one plane of a cell in the first matrix is inferior to the same plane of the cell with the same coordinates, in a second matrix. My matrices have 3 plane in one dimension of varying size (trying with size of 3 atm).

Whatever i try, the comparison just works for the first cell. Each plane of the first cell from the first matrix is compared to each plane of the first cell of the second matrix, and the resulting matrix has a 1 in each plane where the value in the first matrix is less or equal than the corresponding value in the secodn matrix.

What is really odd is that the other cells of the first incoming matrix are not compared with the 2d input matrix’s corresponding cells, but rather they are compared with a 3., which is a value that is used for initialisaiton of each plane/cell in the 2d matrix. But the value of each cell/plane in the second matrix change often, i can see their actual value in the jit.cellblock (which are not 3.), and i have connected a bang out of that 2d cell to check that there is not a change in that matrix so fast that i wouldn’t see it which would explain the comparison.

Here is the relevant portion of the patch.

The "first matrix" i keep refering to comes from the "r positions" and the second matrix comes from the "jit.matrix scaleoftriggers". There is two way of calculating the thing : oen with jit.op @op < =, the other with a jit.gen - they give the same result, except jit.gen outputs one plane, which is the result of an && operation on each plane.

Help me. Please.

```
----------begin_max5_patcher----------
1283.3ocyZ0sbapCD9Z6mBMLc5UtdPR.FeZ6L87bj1IiLnPTNXIFPNwIc569
Q+.1fMjfavDtHXytBw29sR6tZi+87YNaD6oENf+AbCX1reOe1LiHsfYk2OyY
KYeTJovLLmGXxkQzzzMohn+yYgcD4hmLZgk2K1ISoR4yYT6T6jxJjNK.NG9C
7qxgdmfKKXuXFHDszsTbjH8IVr7ds3vvRgYDYz8Ldxs4zHocl87wpmA345sz
eA.EFnuC6uz8vKPMSFrETdOe2VFWgNiPzQgVLaj5UJkEaLYwlG9BzsxVYIbg
58mxTleMSVaGbxVic37u4LRpiVwelOWeYQOYWN8I0aq5UIo6MloSNHSTvjLA
uvoKJ9MozVXOHDp4q.WyUe8UjaMtqAW41JWAOmqV6LnbxlcRof2ocugvSNZ6
sXjXzZsgACPU12qYkv9ZkgeD1R4xczZuA0VB9HrEncK6.aJ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0FzYEiddgnm476KdzcHcJgmdAmfQCNg8.N9S
JzLs3FuIEZviFZB5yx30iFb5SPGzngFudQNi21J7zJlCbhs3oW3AMsfCFNhY
P86q+BNg.DZpgmwaCFpOvIb7B+zm3g3QLb3Dyc0O7DNsvyHF.B2mZlw+sUhY
OwyI+pGzP4jesCm7Kc3zekCpY6Oy+eHH0ckM
-----------end_max5_patcher-----------
```

Now for something new…

[attachment=222212,5495] [attachment=222212,5496]

those two images are separated only by the time i unselect the attyrui object which is selected in the first picture. It makes me think that i made something utterly wrong. I have the matrix "scaleoftriggers" at several places in my patch, any idea if there is something obvious i should not have done ? It would be easier wiht the whole patch maybe but it’s a big thing unfinished, probably hard to understand for now….