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