Files Classes Functions Hierarchy
00001 #include <iostream> 00002 using namespace std; 00003 00004 #include <gausselim.h> 00005 #include <gausselimtest.h> 00006 #include <print.h> 00007 00008 void gausselimtest::test01() 00009 { 00010 double e2[] = 00011 { 00012 3.0, 5.0, 2.0, 00013 3.0, 5.0, 5.0 00014 }; 00015 00016 cout << "Inconsistent gaussian elimination example." << endl; 00017 00018 gausselim<double> g(e2,2); 00019 00020 cout << (stringc)g << endl; 00021 00022 bool res = g.eval(); 00023 00024 cout << "Solve" << endl; 00025 00026 cout << (stringc)g << endl; 00027 00028 cout << "Result: "; 00029 00030 cout << SHOW(res) << endl; 00031 00032 } 00033 00034 void gausselimtest::test02() 00035 { 00036 double e3[] = 00037 { 00038 1.0, 5.0, 0.0, 11.0, 00039 1.0, 1.0, 1.0, 0.0, 00040 2.0, 0.0, 1.0, -1.0 00041 }; 00042 00043 cout << "Solve a 3 by 3 linear equations system." << endl; 00044 00045 gausselim<double> g(e3,3); 00046 00047 cout << "Initial system" << endl; 00048 cout << (stringc)g << endl; 00049 00050 cout << endl; 00051 cout << "Solve system." << endl; 00052 00053 g.eval(); 00054 00055 cout << (stringc)g << endl; 00056 00057 cout << "Get solution" << endl; 00058 double s[3]; 00059 g.columnC(s); 00060 00061 cout << print(s,s+3) << endl; 00062 cout << endl; 00063 00064 } 00065 00066 00067
1.5.8