So jetzt aber:
[code=Java] public static double[][] sumUpCols(double[][] x) {
double[][] a = Stream.of(x).sorted((a0, a1) -> a1.length - a0.length).toArray(double[][]::new);
double[][] r = new double[a[0].length][1];
for (int i = 0; i < a[0].length; i++) {
double sum = 0;
for (int j = 0; j < a.length && i < a[j].length; j++) {
sum += a[j][i];
}
r[i][0] = sum;
}
return r;
}
public static void main(String[] args) {
double[][] x = { { 1, }, { 2, 3, }, { 4, 5, 6, }, };
x = sumUpCols(x);
for (double[] ds : x) {
System.out.println(Arrays.toString(ds));
}
}[/code]
[USER=56216]@temi[/USER] Nein es sollten die Spaltensummen berechnet werden. Ich bin doch nicht doof. 