Forums > Gen

### understanding matrix coords with sample

May 07 2013 | 9:44 am

Hello everybody,

I’ve been digging a bit into Gen lately and I have problems understanding how to choose and construct coordinates for sampling a certain cell in a matrix. I’ve attached a little patch that demonstrates the issue. I fill up a 2×2 1 plane matrix with noise and feed it to Gen. There it will select the cells according to a normalized input vector. I let Gen construct one, and I construct the same one myself through a matrix outside Gen.
But it doesn’t give me the same results when Gen scrolls over the matrix, however as can be seen in the Max window, my normalized input vector is the same as the normalized vector generated in Gen. I’m a bit confused also on how vectors are actually represented, multi planar matrices or multicell, one plane matrices?

``````-- Pasted Max  Patch, click to expand. --

```
Tnx
V.
```
May 07 2013 | 10:27 pm

In order to sample a 2D matrix, you need a 2D coordinate. The matrix of coordinates you’re sending into the jit.gen object is 1-plane, which produces 1D vectors within the jit.gen patch. The [norm] object produces 2D vectors. However, since your input matrix is 1-plane, on output the vector coming out of the norm object will be converted to a 1D vector in order to conform to the I/O format of the object, which is derived from the left-most input.

At this point, all inputs and outputs for a jit.gen object will have the same planecount, type, and dim. If they don’t, they will be converted internally to be so.

I added a 5th outlet to show the 2nd coordinate of the norm operator:

``````
-- Pasted Max  Patch, click to expand. --

```
```
May 08 2013 | 10:32 am

Thanks Wesley for the clear explanation! I think I got it now.

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Gen