Compact stream expression zum transponieren von double [] [] Matrix
Ich möchte ein @ umsetzdouble[][]
matrix mit dem kompaktesten und effizientesten Ausdruck. Im Moment habe ich das:
public static Function<double[][], double[][]> transpose() {
return (m) -> {
final int rows = m.length;
final int columns = m[0].length;
double[][] transpose = new double[columns][rows];
range(0, rows).forEach(r -> {
range(0, columns).forEach(c -> {
transpose[c][r] = m[r][c];
});
});
return transpose;
};
}
Gedanken