I have an array of float [n, 128]. Now I want to convert each line into a separate vector as follows:
// The code here is pseudo code
int n=48; float[,] arrFloat=new float[n,128]; VectorOfFloat v1 = new VectorOfFloat(128);
What is the best way?
I could write the code as follows, but I think there should be a better way:
List<VectorOfFloat> descriptorVec = new List<VectorOfFloat>(); VectorOfFloat v1 = new VectorOfFloat(); var temp = new float[128]; for (int i = 0; i < descriptors1.GetLength(0); i++) { for (int j = 0; j < descriptors1.GetLength(1); j++) { temp[j] = descriptors1[0, j]; } v1.Push(temp); descriptorVec.Add(v1); }
source share