Fastest way to append a wave to itself for N times

Hi,

Let's say I have an inputWave with num of row = 100.
Then I want to have an outputWave which is made from 10 of inputWave stacked up together, which is finally of size 1000.

The naive way I am using is by a for-loop and assign it step-wise:
    duplicate/o inputWave,outputWave
    redimension/N=(LCM) outputWave
   
    variable m
    for (m=1;m<N;m=m+1)
        outputWave[m*numRow,]=inputWave[p-m*numRow]
        endfor


while it works, it takes very long when I have to stack it up for an N of order 1000.
I tried to use FastOp but it does not allow assignment with range.

Appreciated if you can give me a hint.
Try:
MatrixOP/O outputWave=colRepeat(inputWave,10)

If you want the result as a 1D wave use:
MatrixOP/O outputWave=Redimension(colRepeat(inputWave,10),1000,1)


I hope this helps,

A.G.
WaveMetrics, Inc.
Igor wrote:
Try:
MatrixOP/O outputWave=colRepeat(inputWave,10)

If you want the result as a 1D wave use:
MatrixOP/O outputWave=Redimension(colRepeat(inputWave,10),1000,1)


I hope this helps,

A.G.
WaveMetrics, Inc.

That's a godsend, million times faster I guess.
Just that I am still working with Igor 6 so I separated the redimension command to a second call.
Sandbo wrote:

That's a godsend, million times faster I guess.
Just that I am still working with Igor 6 so I separated the redimension command to a second call.


Moving Redimension outside MatrixOP should not affect performance but you should really consider upgrading.