Question: C + + is being used here Implement Gaussian Elimination Gaussian ( double * A , doublex, double * b , int N ) ;

C++ is being used here
Implement Gaussian Elimination Gaussian(double *A, doublex, double *b, int N);
to solve a matrix loaded from file in the agreed to format
Compute the relative error of your solution
Load N, A, b from a file.
Ax = b
e.g. Solve for x when given N, A, b solve for x
--------------------------------
///you have computed the solution x.
compute Ax store as r
subtract r from b, this is the same as b-Ax = diff
find the two norm of the vector diff
hopefully once you divide the two norm by N, you will be near 10^-5 or less
-----------------
Gaussian Elimination Pseudo code
connect to data file
input n
allocate required vectors and matrix
input A[n][n], input b[n]
begin solver
column by column
search for max entry in current column
for each row in current col (0<=row A[maxrow][col]) maxrow = row; maxval=A[row][col]
once maxrow is identified, swap A[maxrow][i] with A[col][i]
temp = A[maxrow][i]
A[maxrow][i]=A[col][i]
A[col][i]=temp
after that, swap the b values, temp = b[maxrow], b[maxrow]=b[col], b[col]=temp
for all columns in A[col][i]= A[col][i]/maxval
eliminate all subdiagonal values for col

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 Programming Questions!