나는 행렬의 역함수를 결정하려고합니다. 즉, 행렬의 보조 계수를 먼저 계산 한 다음이 행렬을 조인하고 마지막으로자바의 행렬 계수 (행렬의 역행렬을 계산할 때 사용)
링크 역이 결정되는 방법을 도시 - I하지만 난 보조인 행렬 고민하고, 트랜스 및 결정을 결정할 방법을 갖고) 행렬식의 값의 역수 (1/결정)에 의해 곱 adjoint 메서드를 사용하여 손으로 http://www.mathwords.com/i/inverse_of_a_matrix.htm 보조자가 손으로 계산하는 방법을 보여주는 링크
나는 결정과 트랜스의 벌금을 계산하는 방법을 가지고,하지만 난 나에게 내가
필요한 출력을 제공하기 위해 공동 인자 방법을 얻을 질수 출력 예제 => 24 (5) -4
24 (5) -4
입니다 24 5 -4하지만 두 번째 & 세 번째 행은 달라야합니다. 제안 사항은 무엇입니까? 감사! 는 여기가 checkIfSquare 및 assigningSign 방법도
public static int[][] cofactor(int[][] matrix) {
int[][] cofactorMatrix = new int[matrix.length][matrix.length];
for (int j = 0; j < matrix.length; j++) {
if (checkIfSquare(matrix)) {
for (int location = 0; location < matrix.length; location++) {
int reducedMatrix[][] = new int[matrix.length - 1][matrix.length - 1];
for (int rows = 1; rows < matrix.length; rows++) {
for (int cols = 0; cols < matrix.length; cols++) {
if (cols > location) {
reducedMatrix[rows - 1][cols - 1] = matrix[rows][cols];
} else if (cols < location) {
reducedMatrix[rows - 1][cols] = matrix[rows][cols];
}
}
}
int sign = assigningSign(location);
cofactorMatrix[j][location] = determinantCalc(reducedMatrix) * sign;
}
}
}
return cofactorMatrix;
}