00001 /* 00002 * Copyright (c) 1999-2001 Eric Gourgoulhon 00003 * 00004 * This file is part of LORENE. 00005 * 00006 * LORENE is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * LORENE is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with LORENE; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 00023 char sxm1_1d_cheb_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/sxm1_1d_cheb.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $" ; 00024 00025 /* 00026 * Operateur [f(x) - f(1)]/(x-1) applique a une fonction f(x) developpee en 00027 * polynomes de Tchebychev (echantillonnage fin: x ds. [-1, 1]) : 00028 * 00029 * f(x) = som_{i=0}^{nr-1} c_i T_i(x) (1) 00030 * 00031 * 00032 * Entree: 00033 * ------ 00034 * int nr : Nombre de coefficients de Tchebyshev dans le 00035 * developpement (2) 00036 * 00037 * Entree/Sortie : 00038 * ------------- 00039 * double* cf : entree: Tableau des nr coefficients c_i de la fonction f(x) 00040 * definis par (1). Le stokage doit etre le suivant 00041 * cf[i] = c_i 0 <= i <= nr - 1 00042 * L'espace memoire correspondant au pointeur cf doit 00043 * etre de taille au moins nr et doit avoir ete 00044 * alloue avant l'appel a la routine 00045 * sortie: Tableau des nr coefficients c_i de la fonction 00046 * f(x)/(x-1). On a cf[nr-1] = 0. 00047 * 00048 */ 00049 00050 00051 /* 00052 * $Id: sxm1_1d_cheb.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $ 00053 * $Log: sxm1_1d_cheb.C,v $ 00054 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon 00055 * LORENE 00056 * 00057 * Revision 2.0 1999/04/26 14:59:56 phil 00058 * *** empty log message *** 00059 * 00060 * 00061 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/sxm1_1d_cheb.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $ 00062 * 00063 */ 00064 00065 00066 00067 //***************************************************************************** 00068 00069 void sxm1_1d_cheb(int nr, double* cf) { 00070 00071 //------------------------------------------------------- 00072 // Formulation effectuant f(x)-f(1)/(x-1) (le coef. c_0 n'intervient donc pas) 00073 //------------------------------------------------------- 00074 00075 int i, j ; 00076 00077 // Coefficient i=0 du resultat : 00078 00079 double som = cf[1] ; 00080 for (j=2; j<nr; j++) { 00081 som += j * cf[j] ; 00082 } 00083 cf[0] = som ; 00084 00085 // Coefficients 1 <= i <= nr-2 du resultat : 00086 00087 for (i=1; i<nr-1; i++) { 00088 som = cf[i+1] ; 00089 for (j=i+2; j<nr; j++) { 00090 som += (j-i) * cf[j] ; 00091 } 00092 cf[i] = 2 * som ; 00093 } 00094 00095 // Coefficient i=nr-1 du resultat : 00096 cf[nr-1] = 0 ; 00097 00098 00099 /* 00100 //------------------------------------------------------- 00101 // Formulation privilegiant c_{0} au detriment de c_{N-1} 00102 //------------------------------------------------------- 00103 00104 00105 // Coefficient i=0 du resultat : 00106 // --------------------------- 00107 int nrm1 = nr - 1 ; 00108 double som = nrm1*cf[0] ; 00109 double cfim1 = cf[0] ; // pour ne pas perdre le coef c_0 de l'entree 00110 int i ; 00111 for (i=1; i<nrm1; i++) { 00112 som += (nrm1-i)*cf[i] ; 00113 } 00114 cf[0] = - som ; 00115 00116 // Coefficient i=1 du resultat : 00117 // --------------------------- 00118 som = cfim1 ; // coef c_0 de l'entree 00119 cfim1 = cf[1] ; // coef c_1 de l'entree 00120 cf[1] = 2 * (cf[0] + som) ; 00121 som += cfim1 ; // a ce stade som = c_0 + c_1 de l'entree 00122 00123 // Coefficients 2 <= i <= nr-2 du resultat : 00124 // ----------============----------------- 00125 for (i=2; i<nrm1; i++) { 00126 cfim1 = cf[i] ; // coef c_i de l'entree 00127 cf[i] = cf[i-1] + 2*som ; 00128 som += cfim1 ; // som = c_0 + c_1 + ... + c_i de l'entree 00129 } 00130 00131 // Coefficient i=nr-1 du resultat : 00132 // ------------------------------ 00133 cf[nrm1] = 0 ; 00134 00135 */ 00136 00137 } 00138 00139 00140
1.4.6