algo.hpp 922 B

1234567891011121314151617181920212223242526272829
  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 norm1(double* u,size_t n);
  18. double norm2(double* u,size_t n);
  19. double error2(double* u,double* v,size_t n);
  20. void clear(double* u,size_t n);
  21. void display(string name,double* u,size_t n);
  22. double bump(double x,double delta_left,double left,double delta_right,double right);
  23. double interpol(double x0,double x1,double t);
  24. #endif