Java Matrix Multiply multiply(double[][] m1, double[][] m2)

Here you can find the source of multiply(double[][] m1, double[][] m2)

Description

multiply

License

Open Source License

Declaration

private static double[][] multiply(double[][] m1, double[][] m2) 

Method Source Code

//package com.java2s;
/*******************************************************************************
* Copyright (c) 2010-2012 ITER Organization.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/

public class Main {
    private static double[][] multiply(double[][] m1, double[][] m2) {
        int p1 = m1.length, p2 = m2.length, q2 = m2[0].length;
        double[][] result = new double[p1][q2];
        for (int i = 0; i < p1; i++)
            for (int j = 0; j < q2; j++)
                for (int k = 0; k < p2; k++)
                    result[i][j] += m1[i][k] * m2[k][j];
        return result;
    }/*  ww  w .  ja  v a  2s .  c o  m*/
}

Related

  1. multiply(boolean[][] matrix, boolean[] vector)
  2. multiply(double[][] a, double[][] b)
  3. multiply(double[][] a, double[][] x)
  4. multiply(double[][] dest, double[][] a, double[][] b)
  5. multiply(double[][] m, double[] x)
  6. multiply(double[][] p, double[][] q)
  7. multiply(double[][] x, double[][] y)
  8. multiply(final double[][] A, final double[][] B)
  9. multiply(float[][] a, float num)