algo.hpp 755 B

12345678910111213141516171819202122232425
  1. #ifndef ALGO_HPP
  2. #define ALGO_HPP
  3. #include "debug.hpp"
  4. #include <cmath>
  5. #include <iostream>
  6. #include <string>
  7. using namespace std;
  8. /*! Thomas algorithm to solve AX=B where A is a tridiagonal matrix
  9. \param n size of the matrix A
  10. \param a (n-1) sub-diagonal coefficients of matrix A
  11. \param b n diagonal coefficients of matrix A
  12. \param c (n-1) sup-diagonal coefficients of matrix A (modified)
  13. \param d n coefficients of vector B (modified)
  14. \param x n coefficients vector to store the result (modified)
  15. */
  16. void Thomas(size_t n,double* a,double* b,double* c,double* d,double* x);
  17. double norm2(double* u,size_t n);
  18. double error2(double* u,double* v,size_t n);
  19. void clear(double* u,size_t n);
  20. void display(string name,double* u,size_t n);
  21. #endif