Java Matrix Transpose transposeInPlace(float[] src)

Here you can find the source of transposeInPlace(float[] src)

Description

transpose In Place

License

Open Source License

Declaration

public static float[] transposeInPlace(float[] src) 

Method Source Code

//package com.java2s;
/*//from w  w w .ja va 2 s . c  om
 * Copyright (c) 2016 JogAmp Community. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation. Sun designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

public class Main {
    public static float[] transposeInPlace(float[] src) {
        float v1 = src[1];
        float v2 = src[2];
        float v3 = src[3];
        float v6 = src[6];
        float v7 = src[7];
        float v11 = src[11];

        //src[0] = src[0];      
        src[1] = src[4];
        src[2] = src[8];
        src[3] = src[12];
        src[4] = v1;
        //src[5] = src[5];      
        src[6] = src[9];
        src[7] = src[13];
        src[8] = v2;
        src[9] = v6;
        //src[10] = src[10];      
        src[11] = src[14];
        src[12] = v3;
        src[13] = v7;
        src[14] = v11;
        //src[15] = src[15];

        return src;
    }
}

Related

  1. transpose2DArray(Double[][] data)
  2. transpose3x3Matrix(float[][] m)
  3. transpose4x4(float m[], float t[])
  4. transpose_image(Object source, int width, int height)
  5. transposeBooleanMatrix(boolean[][] matrix)
  6. transposeMatrix(double[][] m)
  7. transposeMatrix(double[][] m)
  8. transposeMatrix(final float[] msrc, final int msrc_offset, final float[] mres, final int mres_offset)
  9. transposeMatrix3x3(float[] result, float[] m)