concat - what does the 3rd arg do

soundyi's icon

Essentially its about how does concat work - as the docs are only hieroglyphs and I am in the lack of the Rosetta Stone.

The help inside gen is also - I am missing the words for it.

I could do some try and error to find it out (still leaving space for guesswork if I do not catch all possible cases), hence why are such fundamental things undocumented or do I miss something?

I guess its adding a plane.

TFL's icon

I definitely agree about the concat doc, and you're right, it adds planes! Its arguments define the number of inputs and the default value for that input if not connected (acting as 1 plane I think).

I often end up doing something like [concat 3 1] as a reminder that I have a 3D vector coming from left inlet and scalar from right inlet. But the numbers are just remainders and won't actually format your inputs to 3-planes and 1-plane, so you need to take care of this yourself.

soundyi's icon

Thanks @ TFL

I thought I got it, but then I tried to explore the default value you've talked about and now I have to admit I have gone blind, as I don't see the mistake in this simple jit.pix thingy in the attached patcher, which does not even use the 3rd argument (the default value ?).

Compile error : gen_domain: jit.gen: [string "gen2.jit.Target"]:38: invalid value (table) at index 1 in table for 'concat'

... I think I need a break ;-).

Gen Explore.maxpat
Max Patch

TFL's icon

Please, use "copy compressed" instead of uploading files I have to download.

I don't get compilation error on my side. Which version of Max do you use?

Just to be safe, I would explicitly declare the number of planes to your matrix: [jit.matrix 4 float32 11] instead of [jit.matrix @type float32 @dim 1 1].

which does not even use the 3rd argument (the default value ?).

no, it's one argument per desired inlet.

[concat 1 1 1] will give you 3 inputs with 1 as default value.

[concat 0 0 0 1] will give you 4 inputs defaulting to 0 and 1 for the last one (like a [vec 0 0 0 1])

Basically you can think of [concat] like a [vec], except that it adds up planes instead of scalars, and you need to make sure that the total number of planes you give it doesn't exceed the planecount of the input jit.matrix.

soundyi's icon

@TFL : I use Max 8.6.5 on MacOS with Apple Silicon (M1) - and I guess you are using Max 9?

If I use swiz rgb to create a vector instead of vec, I get no compiler error.

Do you have access to a Max 8 installation to verify that this is a Max 8 / MacOS / Apple Silicon thing?

As compilation is involved this may matter - I guess that gen compilation for arm64 is different than for x86. The compiler error also happens with jit.gl.pix, but as Apple Silicon have an embedded GPU, its arm64 too.

However I think this is a case for the C74 support / time for a ticket.

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

And thanks for clarification regarding the default parameters - now I got it.

TFL's icon

My bad, I wasn't sending a matrix into the faulty jit.pix so it was not compiling...
I actually do get the same compilation error with Max 9/MacOS/Apple Silicon. Also tested with Max 8 on the same machine and same error.

At this point I don't know why concatenating a [vec] of size > 1 causes an error but a a [swiz] of the same dimension doesn't. I think it's worth a ticket indeed, unless someone here has an explanation?

soundyi's icon

support ticket is already on its way - will be back with the response

Nodanoma's icon

Yes, all reproduced.

Talking of jit.pix, however, I have a feeling it'll get deprecated soon — it has been buggy for a while and needs proper attention when setting up. That notwithstanding, the same errors occur with jit.gen and also, jit.pix is quite a neat object… with regards to what TFL said about the number of input planes concat input musn't exceed: in case of jit.pix it should be the number of outputplanes which is always 4 (its unique feature as opposed to jit.gen)!

Right?