Here you can find the source of transpose(final double[][] original)
static double[][] transpose(final double[][] original)
//package com.java2s; //License from project: Open Source License public class Main { static double[][] transpose(final double[][] original) { final double[][] d = new double[original[0].length][]; if (original.length > 0) { for (int i = 0; i < original[0].length; i++) { d[i] = new double[original.length]; for (int j = 0; j < original.length; j++) { d[i][j] = original[j][i]; }//from w ww . j ava 2s .co m } } return d; } }