int1d_cheb.C

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 int1d_cheb_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_cheb.C,v 1.1 2005/02/16 15:27:55 m_forot Exp $" ;
00024 
00025 /*
00026  *  Calcul de l'integrale
00027  * 
00028  *      int_-1^1 f(x) dx                        (1)
00029  *
00030  *  pour une fonction f(x)  donnee par ses coefficients de Tchebyshev
00031  *
00032  *      f(x) = som_{i=0}^{nr-1} c_i T_{i}(x)            (2)
00033  *
00034  * Entree:
00035  * ------
00036  *  int nr  :           Nombre de coefficients de Tchebyshev dans le 
00037  *              developpement (2)
00038  *  const double* cf    :   Tableau des nr coefficients c_i de la fonction
00039  *              definis par (2). Le stokage doit etre le suivant
00040  *              cf[i] = c_i   0 <= i <= nr - 1
00041  *              L'espace memoire correspondant au pointeur cf doit
00042  *              etre de taille au moins nr et doit avoir ete 
00043  *              alloue avant l'appel a la routine
00044  *
00045  * Sortie (valeur de retour) :
00046  * ------
00047  *  double int1d_cheb   :   Valeur de l'integrale (1) 
00048  *
00049  */
00050 
00051 /*
00052  * $Id: int1d_cheb.C,v 1.1 2005/02/16 15:27:55 m_forot Exp $
00053  * $Log: int1d_cheb.C,v $
00054  * Revision 1.1  2005/02/16 15:27:55  m_forot
00055  * *** empty log message ***
00056  *
00057  *
00058  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/int1d_cheb.C,v 1.1 2005/02/16 15:27:55 m_forot Exp $
00059  *
00060  */
00061 
00062 
00063 //*****************************************************************************
00064 
00065 double int1d_cheb(int nr, const double* cf){
00066     
00067     double som = - cf[0] ;
00068     const double* cc = cf + 2 ;
00069     
00070     for (int i=2; i<nr ; i=i+2) {
00071       som += *cc / (i*i - 1) ;
00072       cc = cc + 2 ;
00073     }
00074     
00075     return -2*som ; 
00076     
00077 }

Generated on Tue Feb 7 01:35:17 2012 for LORENE by  doxygen 1.4.6