48 Tbl initialize_dd(
int ncoef) {
49 Tbl dd(ncoef, ncoef) ;
51 dd.set(0,0) = 1. ; dd.set(0, 1) = 0 ;
52 dd.set(1, 0) = 0 ; dd.set(1, 1) = 1. ;
53 for (
int i=2; i<ncoef; i++) {
57 for (
int j=2; j<ncoef; j++) {
58 dd.set(0, j) = -dd(0, j-2) ;
59 for (
int i=1; i<ncoef; i++) {
60 dd.set(i, j) = 2.*dd(i-1, j-1) - dd(i, j-2) ;
79 for (
int i=0; i<n_data; i++)
80 powxj.
set(i, 0) = 1. ;
81 for (
int j=1; j<2*n_poly+1; j++) {
82 for (
int i=0; i<n_data; i++) {
83 powxj.
set(i,j) = powxj(i, j-1)*xx(i) ;
88 for (
int j=0; j<2*n_poly+1; j++) {
89 for (
int i=0; i<n_data; i++) {
90 xpow.
set(j) += powxj(i, j) ;
95 for (
int j=0; j<n_poly+1; j++) {
96 for (
int i=0; i<n_data; i++) {
97 rhs.
set(j) += powxj(i, j)*yy(i) ;
102 mat.
set(0,0) = n_data ;
103 for (
int i=0; i<=n_poly; i++) {
104 for (
int j=0; j<=n_poly; j++) {
105 mat.
set(i,j) = xpow(i+j) ;
112 Matrice cheb = initialize_dd(n_poly+1) ;
115 return cheb.
inverse(sol_Taylor) ;
Tbl poly_regression(const Tbl &, const Tbl &, int)
Polynomial regression, giving Chebyshev coefficients.
void set_lu() const
Calculate the LU-representation, assuming the band-storage has been done.
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
double & set(int i)
Read/write of a particular element (index i) (1D case)
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
double & set(int j, int i)
Read/write of a particuliar element.
int get_taille() const
Gives the total size (ie dim.taille)
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void annule_hard()
Sets the Tbl to zero in a hard way.