title: transpose double[][] matrix with a java function?
body: <p>Do anybody have a function with which I can transpose a Matrix in Java which has the following form:</p>
  
  <pre><code>double[][]
  </code></pre>
  
  <p>I have function like this:</p>
  
  <pre><code>public static double[][] transposeMatrix(double [][] m){
      for (int i = 0; i &lt; m.length; i++) {
          for (int j = i+1; j &lt; m[0].length; j++) {
              double temp = m[i][j];
              m[i][j] = m[j][i];
              m[j][i] = temp;
          }
      }
  
      return m;
  }
  </code></pre>
  
  <p>but its wrong somewhere.</p>