'Fast interleave and deinterleave of (jagged) arrays of variable lengths
I want to interleave/convert a jagged array of floats to one array. From:
[
[0.32, 42.21, 13.37, 32.2],
[0.34, 21.2, 4335343.2, 420.2],
[0.1, 727.22, 12.4, 7.27]
]
to
[0.32, 0.34, 0.1, 42.21, 21.2, 727.22, 13.37, 4335343.2, 12.4, 32.2, 420.2, 7.27]
The amount of elements is not known at runtime, but there is always going to be at least two, and the amount of elements in each array in the jagged array is going to be equal. I also then need to de-interleave that array - basically a reversal of what I described above.
How can I do this in C# without a big performance impact?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
