I was wondering if it was possible to combine arrays, in a way in which the n+1 array values are increased by the nth array length.
I can do this simply using loops but i was wondering if it was possible other ways.
Array 1 = 1,2,3,4,5,6
Array 2 = 4,3,2,1
Combined array = 1,2,3,4,5,6 10,9,8,7
for example
float[] finalArray = new float[*length of combined arrays*];
int previousLength = 0;
for (float[] array : arrayList){
for (int i = 0; i < array.length; i ++){
finalArray[i + previousLength] = array[i] + previousLength;
}
previousLength += array.length
}
return finalArray
I'm hoping this explains what I'm trying to do.
I'm currently trying to optimise and it seems this function is taking up a lot of resources. I'm curious if there is a possible alternative.
Purpose:
I'm trying to scan through a dataset, do a complex function and return the results as a float array. Each value in the array would normally be offset by it's own index (to be used later). I am trying to seperate the dataset into smaller datasets and pass each slice to a thread. Then combine the results at the end.