unimportant changes

This commit is contained in:
René Fuhry 2023-05-15 15:29:53 +02:00 committed by GitHub
parent 6dff42fe3c
commit a66c6af575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,7 @@ public class Matrix {
public Matrix(int[][] matrix) {
this.matrix = matrix;
rowLength = matrix.length;
columnLength = rowLength;
columnLength = matrix[0].length;
}
public Matrix multiply(Matrix m) {
@ -66,13 +66,12 @@ public class Matrix {
matrix = new int[rowLength][columnLength];
for(int columnIndex = 0; line != null && columnIndex < matrix.length; columnIndex++, line = br.readLine()) {
for(int columnIndex = 0; line != null; columnIndex++, line = br.readLine()) {
lineArray = line.split(";");
for(int rowIndex=0; rowIndex < matrix[columnIndex].length; rowIndex++) {
matrix[rowIndex][columnIndex] = Integer.parseInt(lineArray[rowIndex]);
}
}
br.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {

View File

@ -3,12 +3,12 @@ public class TestMatrix {
Matrix matrix = new Matrix("/home/old/projects/Java/graphprogram/24n_01.csv");
Matrix scalarProduct;
System.out.println(matrix.getRowLength());
System.out.println(matrix.getColumnLength());
System.out.println("RowLength: " + matrix.getRowLength());
System.out.println("ColumnLength: " +matrix.getColumnLength());
System.out.println(matrix);
System.out.println("\nMatrix A: \n" + matrix);
scalarProduct = matrix.multiply(matrix);
System.out.println(scalarProduct);
System.out.println("\nScalarProduct A²: \n" + scalarProduct);
}
}