MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / gaussian

Method gaussian

src/main/java/com/thealgorithms/maths/Gaussian.java:10–26  ·  view source on GitHub ↗
(int matSize, List<Double> matrix)

Source from the content-addressed store, hash-verified

8 }
9
10 public static ArrayList<Double> gaussian(int matSize, List<Double> matrix) {
11 int i;
12 int j = 0;
13
14 double[][] mat = new double[matSize + 1][matSize + 1];
15 double[][] x = new double[matSize][matSize + 1];
16
17 // Values from arraylist to matrix
18 for (i = 0; i < matSize; i++) {
19 for (j = 0; j <= matSize; j++) {
20 mat[i][j] = matrix.get(i);
21 }
22 }
23
24 mat = gaussianElimination(matSize, i, mat);
25 return valueOfGaussian(matSize, x, mat);
26 }
27
28 // Perform Gaussian elimination
29 public static double[][] gaussianElimination(int matSize, int i, double[][] mat) {

Callers 1

passTest1Method · 0.45

Calls 3

gaussianEliminationMethod · 0.95
valueOfGaussianMethod · 0.95
getMethod · 0.45

Tested by 1

passTest1Method · 0.36