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 mult_xm1_1d_cheb_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/mult_xm1_1d_cheb.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $" ; 00025 00026 /* 00027 * $Id: mult_xm1_1d_cheb.C,v 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon Exp $ 00028 * $Log: mult_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:28:35 phil 00033 * vire double(0.5) 00034 * 00035 * Revision 2.0 1999/04/26 16:16:08 phil 00036 * *** empty log message *** 00037 * 00038 * 00039 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/mult_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) 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) 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 00073 #include <assert.h> 00074 00075 //***************************************************************************** 00076 00077 void mult_xm1_1d_cheb(int nr, const double* cf, double* cresu) { 00078 00079 double aim1 = 0.5 ; 00080 double ai = -1. ; 00081 double aip1 = 0.5 ; 00082 00083 assert(nr>=3) ; 00084 00085 // Coefficient i=0 du resultat : 00086 00087 cresu[0] = ai*cf[0] + aip1*cf[1] ; 00088 00089 // Coefficient i=1 du resultat : 00090 00091 cresu[1] = cf[0] + ai*cf[1] + aip1*cf[2] ; 00092 00093 00094 // Coefficients 2 <= i <= nr-2 du resultat : 00095 00096 int i ; 00097 for (i=2; i<nr-1; i++) { 00098 cresu[i] = aim1*cf[i-1] + ai*cf[i] + aip1*cf[i+1] ; 00099 } 00100 00101 // Coefficient i=nr-1 du resultat : 00102 00103 cresu[nr-1] = aim1*cf[nr-2] + ai*cf[nr-1] ; 00104 00105 } 00106 00107 00108
1.4.6