LORENE
mult_xm1_1d_cheb.C
1/*
2 * Copyright (c) 1999-2001 Eric Gourgoulhon
3 * Copyright (c) 1999-2001 Philippe Grandclement
4 *
5 * This file is part of LORENE.
6 *
7 * LORENE is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * LORENE is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with LORENE; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23
24
25
26/*
27 * $Id: mult_xm1_1d_cheb.C,v 1.3 2016/12/05 16:18:07 j_novak Exp $
28 * $Log: mult_xm1_1d_cheb.C,v $
29 * Revision 1.3 2016/12/05 16:18:07 j_novak
30 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
31 *
32 * Revision 1.2 2014/10/13 08:53:24 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
36 * LORENE
37 *
38 * Revision 2.1 1999/10/11 14:28:35 phil
39 * vire double(0.5)
40 *
41 * Revision 2.0 1999/04/26 16:16:08 phil
42 * *** empty log message ***
43 *
44 *
45 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/mult_xm1_1d_cheb.C,v 1.3 2016/12/05 16:18:07 j_novak Exp $
46 *
47 */
48
49
50/*
51 * Operateur (x-1) Id applique a une fonction f(x) developpee en
52 * polynomes de Tchebychev (echantillonnage fin: x ds. [-1, 1]) :
53 *
54 * f(x) = som_{i=0}^{nr-1} c_i T_i(x) (1)
55 *
56 *
57 * Entree:
58 * ------
59 * int nr : Nombre de coefficients de Tchebyshev dans le
60 * developpement (1)
61 *
62 * const double* cf : Tableau des nr coefficients c_i de la fonction f(x)
63 * definis par (1). Le stokage doit etre le suivant
64 * cf[i] = c_i 0 <= i <= nr - 1
65 * L'espace memoire correspondant au pointeur cf doit
66 * etre de taille au moins nr et doit avoir ete
67 * alloue avant l'appel a la routine.
68 * Sortie :
69 * -------
70 * double* cresu : Tableau des nr coefficients de la fonction
71 * (x-1) f(x).
72 * L'espace memoire correspondant au pointeur cresu doit
73 * etre de taille au moins nr et doit avoir ete
74 * alloue avant l'appel a la routine.
75 *
76 */
77
78
79 #include <cassert>
80
81namespace Lorene {
82
83//*****************************************************************************
84
85void mult_xm1_1d_cheb(int nr, const double* cf, double* cresu) {
86
87 double aim1 = 0.5 ;
88 double ai = -1. ;
89 double aip1 = 0.5 ;
90
91 assert(nr>=3) ;
92
93// Coefficient i=0 du resultat :
94
95 cresu[0] = ai*cf[0] + aip1*cf[1] ;
96
97// Coefficient i=1 du resultat :
98
99 cresu[1] = cf[0] + ai*cf[1] + aip1*cf[2] ;
100
101
102// Coefficients 2 <= i <= nr-2 du resultat :
103
104 int i ;
105 for (i=2; i<nr-1; i++) {
106 cresu[i] = aim1*cf[i-1] + ai*cf[i] + aip1*cf[i+1] ;
107 }
108
109// Coefficient i=nr-1 du resultat :
110
111 cresu[nr-1] = aim1*cf[nr-2] + ai*cf[nr-1] ;
112
113}
114
115
116
117}
Lorene prototypes.
Definition app_hor.h:67