00001 #include "cammva.h"
00002 #include <stdio.h>
00003 #include <iostream.h>
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 int main(){
00016
00017 CAMdoubleMatrix A(3,3);
00018 CAMdoubleVector b(3);
00019 CAMdoubleVector x(3);
00020 CAMdoubleVector residual(3);
00021
00022 long i,j;
00023
00024
00025 for(i=1; i<= 3; i++)
00026 for(j=1; j<= 3; j++)
00027 {
00028 A(i,j)=1.0/(double(i) + double(j));
00029 }
00030
00031 for(i=1; i<=3; i++)
00032 {
00033 b(i)=double(i);
00034 }
00035
00036 x=A/b;
00037 residual=A*x - b;
00038
00039
00040
00041
00042 cout.setf(ios::scientific, ios::floatfield);
00043
00044 cout << " The matrix A " << endl;
00045 cout << A;
00046 cout << " The vector b " << endl;
00047 cout << b;
00048 cout << " The solution of A*x=b " << endl;
00049 cout << x;
00050 cout << " The residual " << endl;
00051 cout << residual;
00052
00053 cout << " Program End : Hit Any Key to Terminate " << endl;
00054 getchar();
00055 return 0;
00056 }
00057
00058