Change Matrix dimension and plane count inside [jit.gen]

Jan M's icon

Hi genners,

I just started to get my head around [jit.gen] . Do input and output matrices always have the same dimensions and plane count, or ist it possible to to change/re-arrange a matrix.

In my case I am working on small matrices performing trigonometric calculations.
Can I transform an input matrix with one plane and the dimensions 6 x1
to a matrix with two planes and the dimensions 2x1?

The first three cells of the input matrix shall be mapped to the first cell of the output matrix (onto three planes) - and the same for the last three cells of the input matrix to the second cell of the output:

Input:
|--------------------------|
| a | b | c | d | e | f | -> plane 0
|--------------------------|

Output:
|---------|
| a | d | -> plane 0
| b | e | -> plane 1
| c | f | -> plane 2
|---------|

Thanks, Jan

metamax's icon

Jan, the left input sets the dim, planecount and data type for all inlets and outlets.

Jan M's icon

Thanks Metamax,

I was aware of this - but whatever i set as dimension or planecount attribute (even with adapt set to 0) the output format seems to be always the same as the input format. Is there a way to have different input and output dimensions and planecounts? I am not really a natural in matrices - maybe that's something completely of the idea of matrix calculation ....

Jesse's icon

jit.repos should do what you're after. I don't think it's possible in jit.gen.

metamax's icon

Jan, my understanding is that jit.gen can have n inlets/outlets but they all have to be the same size as the left inlet. Hence, the thinking is a bit backwards. In terms of size, you need to give it what you want.. rather than giving it something else to make what you want. If that makes sense.

Jan M's icon

it does. And actually right now I realize that this it what is described in the help file : "...generates new Jitter Matrix Operator objects". It is for matrix operators not to transform matrices. So for transforming a matrix i'll have to stick to plain jitter objects.

Thanks!!

Chris Vik's icon

Yo Jan. Bit late to the party.

You can work with different dimension matricies - BUT, the output will always maintain the same attributes of the matrix entering in [jit.gen]'s first inlet.

Max Patch
Copy patch and select New From Clipboard in Max.

The great bit about this is that you don't even need to use that matrix in any calculations; you can just bang a blank matrix that matches the format you want your output to be and trigger your calculations.

Modulo [%] in combination with [/] into [int] will be your bread and butter when you're translating between matrix dimensions.

nicolasnuzillard's icon

Here is an elegant way of doing what you want :)

Max Patch
Copy patch and select New From Clipboard in Max.

But there is still useless calcuations, I was expecting to find something more powerful

Jan M's icon

@NICOLASNUZILLARD Nice!!!! Thank you

nicolasnuzillard's icon

This technique is usefull when you want an audio signal to set the XYZ position of an array of 3d points. I had the idea by watching the patch 22.CatchNurbs in the JitterRecipes. In the exemple patch I'm mentionning I didn't like the use of messages send to a matrix object so I did it a way so you don't have to send any messages.

Gussi's icon

Alternatively,
you could do the same thing with "jit.coerce" (check example).
Combined with "jit.scanwrap" and "jit.dimmap" or "jit.transpose",
you can solve most matrix "conversion/re-organization" problems.

Max Patch
Copy patch and select New From Clipboard in Max.

Nodanoma's icon

@Gussi

Thank you so much for clarifying jit.coerce – I had been attempting to solve dim/plane-remapping using codebox to no avail and this opens up to super-sustainable methods.