114 Introduction to C++ Programming and Graphics
{
inputdata >> b[i];
}
inputdata.close();
//--- Display:
cout << endl ;
cout << " Matrix - initial vector:";
cout << "\n\n";
for (i=1;i<=n;i++)
{
for (j=1;j<=n;j++)
{
cout << setw(8) << a[i][j];
}
cout <<""<<setw(8) << b[i] << endl;
}
cout << "\n\n";
//--- Mapping:
int icount=0, more=1;
while (more!=0)
{
matvec (n,a,b,c);
for (i=1;i<=n;i++)
{
b[i]=c[i];
}
//..................
if(norm == 1)
{
double rnorm = 0;
for (i=1;i<=n;i++)
{
rnorm = rnorm + b[i]*b[i];
}
rnorm = sqrt(rnorm);
for (i=1;i<=n;i++)
{
b[i]=b[i]/rnorm;
}
}