Question: Implement this pseudo code with Java. n is the size of the matrix for an n x n matrix. k points to the pivot. i

Implement this pseudo code with Java.

n is the size of the matrix for an n x n matrix.

k points to the pivot.

i points to the equation being eliminated.

j points to the term you're working with.

Naive Gaussian Elimination

// Forward Elimination

function FwdElimination(coeff : array(n,n), const : vector(n)) for k = 1 to (n - 1) for i = k + 1 to n mult := coeff[i][k] / coeff[k][k] for j <- k + 1 to n coeff[i][j] := coeff[i][j] - mult * coeff[k][j] end for const[i] := const[i] - mult * const[k] end for end for end function

// Back Substitution

function BackSubst(coeff : array(n,n), const : vector(n), sol : vector(n)) sol[n] := const[n] / coeff[n][n] for i = n - 1 to 1 sum := const[i] for j <- i + 1 to n sum := sum - coeff[i][j] * sol[j] end for sol[i] := sum / coeff[i][i] end for end function

// Naive Gaussian algorithm

function NaiveGaussian(coeff : array(n,n), const : vector(n)) sol := new array(n,n) call FwdElimination(coeff,const) call BackSubst(coeff, const, sol) end function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!