Here you can find the source of transpose(float[] mat, float[] dest)
public static float[] transpose(float[] mat, float[] dest)
//package com.java2s; //License from project: Open Source License public class Main { public static float[] transpose(float[] mat, float[] dest) { // If we are transposing ourselves we can skip a few steps but have to // cache some values if (dest == null || mat == dest) { float a0 = mat[1], a2 = mat[2], a5 = mat[5]; mat[1] = mat[3];// w ww. jav a 2 s.c o m mat[2] = mat[6]; mat[3] = a0; mat[5] = mat[7]; mat[6] = a2; mat[7] = a5; return mat; } dest[0] = mat[0]; dest[1] = mat[3]; dest[2] = mat[6]; dest[3] = mat[1]; dest[4] = mat[4]; dest[5] = mat[7]; dest[6] = mat[2]; dest[7] = mat[5]; dest[8] = mat[8]; return dest; } }