Java Matrix Transpose transpose(boolean[][] matrix)

Here you can find the source of transpose(boolean[][] matrix)

Description

return the transpose of a boolean matrix

License

Apache License

Parameter

Parameter Description
matrix a parameter

Declaration

public static boolean[][] transpose(boolean[][] matrix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from  w w w  .  jav a2s  . c o  m
     * return the transpose of a boolean matrix
     * @param matrix
     * @return
     */
    public static boolean[][] transpose(boolean[][] matrix) {
        if (matrix == null) {
            return null;
        }
        int m = matrix.length;
        int n = matrix[0].length;
        boolean[][] t = new boolean[n][m];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                t[j][i] = matrix[i][j];
            }
        }
        return t;
    }
}

Related

  1. matrixTrans_x_diagonalMatrix_x_Matrix(double[][] mat, double[] diag)
  2. matrixTrans_x_matrix(double[][] mat)
  3. matrixTransform(Object[][] datas)
  4. matrixTranspose(Object[][] matrix)
  5. transpose(boolean[][] inputMatrix)
  6. transpose(boolean[][] toBeTransposed)
  7. transpose(byte[][] d)
  8. transpose(double array[], int W, int H, int D)
  9. transpose(double[] m)