internal virtual Array2DRowRealMatrix ArrayToRealMatrix(ArrayList arrayList, int num) { int num2 = ((float[])arrayList.get(1)).Length; Array2DRowRealMatrix array2DRowRealMatrix = new Array2DRowRealMatrix(num, num2); for (int i = 0; i < num; i++) { double[] array = new double[num2]; for (int j = 0; j < num2; j++) { array[j] = (double)((float[])arrayList.get(i))[j]; } array2DRowRealMatrix.setRow(i, array); } return(array2DRowRealMatrix); }
/** * @param lst * An ArrayList with all the values being vectors of the same * dimension * @return The RealMatrix with the vectors from the ArrayList on columns */ static Array2DRowRealMatrix ArrayToRealMatrix(List <float[]> lst, int size) { int length = lst[1].Length; var ret = new Array2DRowRealMatrix(size, length); int i = 0; for (i = 0; i < size; i++) { double[] converted = new double[length]; for (int j = 0; j < length; j++) { converted[j] = ((lst[i])[j]); } ret.setRow(i, converted); } return(ret); }