Java Matrix Multiply matrixMultiply(double[][] M1, double[][] M2)

Here you can find the source of matrixMultiply(double[][] M1, double[][] M2)

Description

multiplies two 3x3 - matrixes NOT TESTED!!

License

Open Source License

Declaration

public static double[][] matrixMultiply(double[][] M1, double[][] M2) 

Method Source Code

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

public class Main {
    /**//w w  w.  j a  va 2s .c  o m
    multiplies two 3x3 - matrixes
    NOT TESTED!!
     */
    public static double[][] matrixMultiply(double[][] M1, double[][] M2) {
        double[][] M = new double[3][3];
        M[0][0] = M1[0][0] * M2[0][0] + M1[0][1] * M2[1][0] + M1[0][2] * M2[2][0];
        M[0][1] = M1[0][0] * M2[0][1] + M1[0][1] * M2[1][1] + M1[0][2] * M2[2][1];
        M[0][2] = M1[0][0] * M2[0][2] + M1[0][1] * M2[1][2] + M1[0][2] * M2[2][2];
        M[1][0] = M1[1][0] * M2[0][0] + M1[1][1] * M2[1][0] + M1[1][2] * M2[2][0];
        M[1][1] = M1[1][0] * M2[0][1] + M1[1][1] * M2[1][1] + M1[1][2] * M2[2][1];
        M[1][2] = M1[1][0] * M2[0][2] + M1[1][1] * M2[1][2] + M1[1][2] * M2[2][2];
        M[2][0] = M1[2][0] * M2[0][0] + M1[2][1] * M2[1][0] + M1[2][2] * M2[2][0];
        M[2][1] = M1[2][0] * M2[0][1] + M1[2][1] * M2[1][1] + M1[2][2] * M2[2][1];
        M[2][2] = M1[2][0] * M2[0][2] + M1[2][1] * M2[1][2] + M1[2][2] * M2[2][2];
        return (M);
    }
}

Related

  1. matrixMult(final float[] result, float[] m1, float[] m2)
  2. matrixMultiplication(double[][] w, double[][] v)
  3. matrixMultiply(double[][] A, double[][] B, int aHeight, int bWidth, int comm, int bz, double[][] C)
  4. matrixMultiply(double[][] A, double[][] B, int n)
  5. matrixMultiply(double[][] M, float[] V)
  6. matrixmultiply(final double[][] A, final double[] b)
  7. matrixMultiplyTwo(final double[][] first, final double[][] second)
  8. matrixMultiplyWithThreadOffset(double[] A, double[] Adiag, double[] B, int aHeight, int bWidth, int comm, int bz, int threadRowOffset, int rowOffset, double[] C)
  9. matrixScalarMultiplication(double[][] w, double v)