Guest User

Untitled

a guest
Dec 9th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////
  2. // Zadanie 6 //
  3. // Autor: Wojciech Kopeć //
  4. ///////////////////////////////////////////////////////////////
  5.  
  6. #include <iostream>
  7. #include <math.h>
  8. #include <tnt/jama_svd.h>
  9.  
  10. using namespace std;
  11. using namespace JAMA;
  12. using namespace TNT;
  13. const int size=5; //wieklosc macierzy
  14. const int p=8; //dokladnosc wynikow
  15.  
  16. int main()
  17. {
  18. Array2D<double> matrix[5][5]={{-116.66654, 583.33346, -333.33308, 100.00012, 100.00012},
  19. {583.33346, -116.66654, -333.33308, 100.00012, 100.00012},
  20. {-333.33308, -333.33308, 133.33383, 200.00025, 200.00025},
  21. {100.00012, 100.00012, 200.00025, 50.000125, -649.99988,},
  22. {100.00012, 100.00012, 200.00025, -649.99988, 50.000125}};
  23. Array2D<double> b1[5]={-0.33388066, 1.08033290, -0.98559856, 1.31947922, -0.09473435};
  24. Array2D<double> b2[5]={-0.33388066, 1.08033290, -0.98559855, 1.32655028, -0.10180541};
  25. Array2D<double> b3[5]={0.72677951, 0.72677951, -0.27849178, 0.96592583, 0.96592583};
  26. Array2D<double> b4[5]={0.73031505, 0.73031505, -0.27142071, 0.96946136, 0.96946136};
  27. Array2D<double> z1[5], z2[5], z3[5], z4[5], b1_b2[5], b3_b4[5], z1_z2[5], z3_z4[5]={0, 0, 0, 0, 0};
  28. Array2D<double> L;
  29. Array2D<double> U;
  30. Array1D<double> X;
  31.  
  32. LU<double> lu(A);
  33.  
  34. L = lu.getL();
  35. U = lu.getU();
  36.  
  37. cout.precision(p);
  38. z1=lu.solve(b1);
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment