I have a list of 3D coordinates (x,y,z) that specify a scalar value (rho) at each location, which I have loaded into a repa array:
a :: Array D DIM1 (Int, Int, Int, Double)
i.e. each array element is a 4-tuple, representing (x,y,z,rho). Also, I'm not tied to using repa.
I would like to transform this into a DIM3 array, with each location containing the appropriate rho value (or a default value, or perhaps an interpolated value).
I can't think of a way to do this with traverse
(at least not efficiently), because traverse
uses indices from the new array, not the source array. Is it possible at all with repa, or do I need to use a different array library (even a mutable one)?