Hi, I have a large matrix I want to resample. Typical size is about 20_000 * 500.
The code I have for now looks like this:
using DSP: resample
function resample_parallel(signal::Matrix{Float32}, rate::Real)
result = pmap(x_slices -> Float32.(resample(x_slices, rate)), eachcol(signal))
return hcat(result...)
end
This is my other version
function test(signal::Matrix{Float32}, rate::Real)
rows, cols = size(signal)
new_rows = Int(floor(rows * rate))
result = Matrix{Float32}(undef, new_rows, cols)
slices = pmap(x_slices -> Float32.(resample(x_slices, rate)), eachcol(signal))
for (i, slice) in enumerate(slices)
@inbounds result[:, i] = slice
end
return result
end
In essence, I want resample each column in parallel, and gather the new result to a matrix. I have tried preallocating the matrix, but it does not work much faster.