Format code with prettier (#3375)

This commit is contained in:
acbin
2022-10-03 17:23:00 +08:00
committed by GitHub
parent 32b9b11ed5
commit e96f567bfc
464 changed files with 11483 additions and 6189 deletions

View File

@ -3,12 +3,12 @@ package com.thealgorithms.misc;
import java.util.Scanner;
/*
* Wikipedia link : https://en.wikipedia.org/wiki/Invertible_matrix
*
* Here we use gauss elimination method to find the inverse of a given matrix.
* To understand gauss elimination method to find inverse of a matrix: https://www.sangakoo.com/en/unit/inverse-matrix-method-of-gaussian-elimination
*
* We can also find the inverse of a matrix
* Wikipedia link : https://en.wikipedia.org/wiki/Invertible_matrix
*
* Here we use gauss elimination method to find the inverse of a given matrix.
* To understand gauss elimination method to find inverse of a matrix: https://www.sangakoo.com/en/unit/inverse-matrix-method-of-gaussian-elimination
*
* We can also find the inverse of a matrix
*/
public class InverseOfMatrix {
@ -52,8 +52,7 @@ public class InverseOfMatrix {
for (int i = 0; i < n - 1; ++i) {
for (int j = i + 1; j < n; ++j) {
for (int k = 0; k < n; ++k) {
b[index[j]][k]
-= a[index[j]][i] * b[index[i]][k];
b[index[j]][k] -= a[index[j]][i] * b[index[i]][k];
}
}
}
@ -72,8 +71,8 @@ public class InverseOfMatrix {
return x;
}
// Method to carry out the partial-pivoting Gaussian
// elimination. Here index[] stores pivoting order.
// Method to carry out the partial-pivoting Gaussian
// elimination. Here index[] stores pivoting order.
public static void gaussian(double a[][], int index[]) {
int n = index.length;
double c[] = new double[n];