I’m not sure if this is the right category, but I’m trying to change the size of a 2d array at k-rate. I want it to work like the trim opcode, but for 2d arrays. (I don’t want it to maintain the array capacity like reshapearray). So far, I’ve tried using the getrow and setrow opcodes to separate the array into 1d arrays, trimming it, then putting it back into a 2d array, but that’s inefficient and I can’t get it to work. Here’s what I’d been using:
kSeq[][] init 3, 16
;-----------------------
kr1[] getrow kSeq, 1
kr2[] getrow kSeq, 2
kr3[] getrow kSeq, 3
;---------------------------
trim kr1, kLeng
trim kr2, kLeng
trim kr3, kLeng
;-----------------------------
kSeq setrow kr1, 1
kSeq setrow kr2, 2
kSeq setrow kr3, 3
The message I get when I increase kLeng is:
PERF ERROR in instr 1 line 62: Array too small (allocated 128 < needed 136), but can’t allocate during performance pass. Allocate a bigger array at init time
Line 62 is the first trim opcode.
Is there any better way to trim 2d arrays? If not, any idea why this doesn’t work?
Thanks!