Here you can find the source of transpose(double[] m)
public static double[] transpose(double[] m)
//package com.java2s; //License from project: BSD License public class Main { /**/*www . ja v a 2 s . c o m*/ * Turns columns into rows and rows into columns. */ public static double[] transpose(double[] m) { return new double[] { m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15] }; } }