Java Matrix Multiply multiply(boolean[][] matrix, boolean[] vector)

Here you can find the source of multiply(boolean[][] matrix, boolean[] vector)

Description

multiply

License

Apache License

Declaration

public static boolean[] multiply(boolean[][] matrix, boolean[] vector) 

Method Source Code

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

public class Main {
    public static boolean[] multiply(boolean[][] matrix, boolean[] vector) {
        if (matrix == null || vector == null) {
            return null;
        }//  w  ww  .ja v a 2s  .  com
        if (matrix[0].length != vector.length) {
            return null;
        }
        int n = matrix[0].length;
        int m = matrix.length;
        boolean[] result = new boolean[m];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                result[i] = result[i] ^ (matrix[i][j] & vector[j]);
            }
        }
        return result;
    }
}

Related

  1. matrixmultiply(final double[][] A, final double[] b)
  2. matrixMultiplyTwo(final double[][] first, final double[][] second)
  3. matrixMultiplyWithThreadOffset(double[] A, double[] Adiag, double[] B, int aHeight, int bWidth, int comm, int bz, int threadRowOffset, int rowOffset, double[] C)
  4. matrixScalarMultiplication(double[][] w, double v)
  5. multiply(boolean[][] m1, boolean[][] m2)
  6. multiply(double[][] a, double[][] b)
  7. multiply(double[][] a, double[][] x)
  8. multiply(double[][] dest, double[][] a, double[][] b)
  9. multiply(double[][] m, double[] x)