matrix to stream of numbers

Roman Thilenius's icon

what ways exist to transform a matrix frame into a stream of consecutive numbers - and back - beside uzi -> getcell/setcell?

TFL's icon

[jit.iter]?

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

Pedro Santos's icon

And then jit.fill

Roman Thilenius's icon

ok iter/fill is what i use in my abstractions.

what about the same for lines and columns? would you go over audio signals eventually? (nonrealtime application/still images)

TFL's icon

For lines and columns, you could use [jit.iter] and [jit.iter @mode 1], followed by [zl.group W] and [zl.group H] respectively, where W and H are the width and height of your matrix multiplied by the number of planes. For example a 4 planes 8*8 matrix thrown into [jit.iter] then [zl.group 32] will give you successive lists for each row.

Roman Thilenius's icon

wow, i never noticed "mode 1"!

but there is nothing more effective than iter? ok.

Nicholas Hobson's icon

if you don't need to know the rows/columns attached to the values [jit.spill] should work for you too.

Roman Thilenius's icon

for me it is a question of list length and what i need to calculate with the values.

as soon as there is a second matrix/operator, there is no way around using uzi/getpixel.

but for one matrix with an unop only, iter/setpixel does the job well. (say for example doing /7. and rounding back to char)

as soon as only one plane (of 3 or 4 planes) is needed to change, iter/fill (and passing the other planes) is much faster than iter/setpixel.

spill (the missing "getall"!) might be very effective, too, while supporting more than unops (via [vexpr @ scalarmode 1] ), but such a patch would have to be completely replaced in oder versions of max, where even the [iter 1] max object had a list lenght limit. (i always try to support max 4 through 8, and that only works upwards)

the more options, the more diffult the choices. compared to audio DSP, video processing is a maze...