feat: Matrix Mult verbessert

main
Andreas Wurst 2025-05-20 10:28:53 +02:00
parent b151cbe35c
commit c43797aa19
1 changed files with 9 additions and 2 deletions

View File

@ -47,19 +47,26 @@ public class Vector {
}
public static int[][] matrixMultiplication(int[][] matrix, int scalar) {
int[][] ausgabe = null;
int[][] ausgabe;
// boolean matrixFlag = false;
// if (matrix.length ==3 && matrix[0].length == 3 && matrix[1].length == 3 &&
// matrix[2].length == 3){
// matrixFlag =true;
// }
if (matrix.length == 3 && matrix[0].length == 3 && matrix[1].length == 3 && matrix[2].length == 3) {
if (matrix == null){
ausgabe = null;
}
else if (matrix.length == 3 && matrix[0].length == 3 && matrix[1].length == 3 && matrix[2].length == 3) {
ausgabe = new int[3][3];
for (int außenPos = 0; außenPos < matrix.length; außenPos++) {
for (int innenPos = 0; innenPos < matrix[außenPos].length; innenPos++) {
ausgabe[außenPos][innenPos] = matrix[außenPos][innenPos] * scalar;
}
}
}
else {
ausgabe = null;
}
return ausgabe;