Created
May 29, 2015 16:38
-
-
Save arestifo/0b1ad7aaad096f70d64f to your computer and use it in GitHub Desktop.
Matrix multiplication class (actual multiplication)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.bcchack.ap; | |
| public class MatrixMultiply { | |
| public static int[][] multiplyMatrices(int[][] a, int[][] b) | |
| { | |
| int[][] ret = new int[a.length][b[0].length]; | |
| for (int row = 0; row < a.length; row++) | |
| { | |
| for (int col = 0; col < b[0].length; col++) | |
| { | |
| for (int col2 = 0; col2 < a[0].length; col2++) | |
| { | |
| ret[row][col] += a[row][col2] * b[col2][col]; | |
| } | |
| } | |
| } | |
| return ret; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment