Question
public class Main { public static void main(String[] args) { // matrix multiplication requires that matrix1 to have the same number of rows as matrix2
public class Main { public static void main(String[] args) { // matrix multiplication requires that matrix1 to have the same number of rows as matrix2 has columns and vice versa int a = 3; int b = 2; float[] m1 = new float[]{1, 2, 3, 4, 5, 6}; float[] m2 = new float[]{7, 8, 9, 10, 11, 12}; // create test matrices /*Matrix matrix1 = new Matrix(a, b, m1); matrix1.printMatrix(); Matrix matrix2 = new Matrix(b, a, m2); matrix1.printMatrix(); Matrix matrix3 = new Matrix(a, a); // print matrices & their dimensions matrix1.printMatrix(); matrix2.printMatrix(); // multiply matrices matrix3 = matrix1.matrixMult(matrix2); // print matrix 3 matrix3.printMatrix();*/ } } // end class Main
public class Matrix { private static int MAXSIZE = 99; private Vect[] m = new Vect[99]; private int rows; private int columns; // create default array of size 1 public Matrix() { m[0] = new Vect(); rows = 1; columns = 1; } // create an empty rxc matrix public Matrix(int r, int c) { rows = r; columns = c; int j = 0; for (int i = 0; i
for (int i = 0; i
// loop through row, setting column values for (int j = 0; j
public class Vect { private static int MAXSIZE = 99; private float[] v = new float[MAXSIZE]; private int size; // if no arguments, create a vector of length 1 public Vect() { size = 1; this.v = new float[1]; v[0] = 0; } // create a vector of length size public Vect(int length) { size = length; this.v = new float[size]; for (int i = 0; i
Debug the package found in the attached Debugging zip folder. You'll find that it's very broken. Its supposed to do matrix multiplication. It mostly just crashes. And if it weren't crashing, it wouldn't be working as advertised. Unzip it, fix it, add appropriate comments, and hand it in. Here's a handy website to test your results: http://www.bluebit.gr/matrix-calculator /matrix- multiplication aspx
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started