Java Matrix Multiply multiply(int[][] mat1, int[][] mat2)

Here you can find the source of multiply(int[][] mat1, int[][] mat2)

Description

multiply

License

Open Source License

Declaration

public static int[][] multiply(int[][] mat1, int[][] mat2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int[][] multiply(int[][] mat1, int[][] mat2) {
        int sizeY = mat1.length;
        int sizeX = mat1[0].length;
        int tmp = 0;
        int[][] result = new int[sizeX][sizeY];
        for (int i = 0; i < sizeX; i++) {
            for (int j = 0; j < sizeX; j++) {
                tmp = 0;//  ww w . j a  v a 2s  .  c  o m
                for (int k = 0; k < sizeY; k++) {
                    tmp += mat1[k][j] * mat2[i][k];
                }
                result[i][j] = tmp;
            }
        }
        return result;
    }
}

Related

  1. multiply(double[][] p, double[][] q)
  2. multiply(double[][] x, double[][] y)
  3. multiply(final double[][] A, final double[][] B)
  4. multiply(float[][] a, float num)
  5. multiply(float[][] a, float[][] b)
  6. multiply(String[] tempResult, int nextIndex, String[][] pys)
  7. multiplyAffine(final double[][] A, final double[][] B, final double[][] dest, int n)
  8. multiplyMatrices(double[][] a, double[][] b)
  9. multiplyMatrices(float[][] left, float[][] right)