Program
Program
#include<iomanip>
#include<cmath>
disp_matrix(M, r, c);
cout<<endl;
}
if(flag != 1)
{
cout<<"Infinite solutions exist "<<endl;
}
else
{
float sum=0;
for(int i = r-1; i>=0; i--)
{
sum = *(M + i*c + (c-1));
for (int j = r-1-i; j<c; j++)
{
sum -= *(M + i*c + j) * (*(x+j));
}
*(x + i) = sum/(*(M + i*c + i));
}
int main()
{
int r, c;
double conditioning_parameter;
double M[r][c];
cout<<"Enter B"<<endl<<endl;
enter_B(*M, r, c);
disp_matrix(*M, r, c);
float x[r];
cout<<"Gaussian Elimination"<<endl;
Gaussian_elimination(*M, r, c, x);
return 0;
}
/*
cout<<"After performing row operation"<<endl;
//disp_matrix_EM(r,c,&e);
e++;
cout<<endl;
//convert_identity(r,c);
if((M[ip][ip]!=0)&&(M[ip][ip]!=1)&&(M[ip][ip]>=0.00001))
{
float a=M[ip][ip];
for(int j=0; j<c; j++)
{
M[ip][j]=M[ip][j]/a;
}
cout<<"After dividing by pivot"<<endl;
//disp_matrix_EM(r,c,&e);
cout<<endl;
e++;
}
if(ip>=1) // only make column elements above pivot zero if its not on the
first row
{
for(int ir=ip-1; ir>=0;ir--) // subtracting column elements above pivot to
be zero
{
float fact = M[ir][ip];
*/