Here you can find the source of transposeMatrix(double[][] m)
public static double[][] transposeMatrix(double[][] m)
//package com.java2s; //License from project: Open Source License public class Main { public static double[][] transposeMatrix(double[][] m) { double[][] temp = new double[m[0].length][m.length]; for (int i = 0; i < m.length; i++) for (int j = 0; j < m[0].length; j++) temp[j][i] = m[i][j];/*from w ww.ja va2s . co m*/ return temp; } }