ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/math/ChebyshevPolynomials.cpp
Revision: 1748
Committed: Wed Nov 17 21:47:42 2004 UTC (19 years, 7 months ago) by tim
File size: 2250 byte(s)
Log Message:
UreyBradleyBend and GhostBend

File Contents

# Content
1 /*
2 * Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project
3 *
4 * Contact: oopse@oopse.org
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1
9 * of the License, or (at your option) any later version.
10 * All we ask is that proper credit is given for our work, which includes
11 * - but is not limited to - adding the above copyright notice to the beginning
12 * of your source code files, and to any copyright notice that you may distribute
13 * with programs based on this work.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 */
25
26 #include "math/ChebyshevPolynomials.hpp"
27
28 namespace oopse {
29 ChebyshevPolynomials::ChebyshevPolynomials(int maxPower) : maxPower_(maxPower){
30
31 assert(maxPower >= 0);
32 GeneratePolynomials(maxPower_);
33 }
34
35 ChebyshevPolynomials::GeneratePolynomials(int maxPower) {
36
37 GenerateFirstTwoTerms();
38
39 DoublePolynomial twoX;
40 twoX.setCoefficient(1, 2.0);
41
42 //recursive generate the high order term of Chebyshev Polynomials
43 //Cn+1(x) = Cn(x) * 2x - Cn-1(x)
44 for (int i = 2; i <= maxPower; ++i) {
45 DoublePolynomial cn;
46
47 cn = polyList_[i-1] * twoX - polyList_[i-2];
48 polyList_.push_back(cn);
49 }
50 }
51
52
53 ChebyshevT::GenerateFirstTwoTerms() {
54 DoublePolynomial t0;
55 t0.setCoefficient(0, 1.0);
56 polyList_.push_back(t0);
57
58 DoublePolynomial t1;
59 t1.setCoefficient(1, 1.0);
60 polyList_.push_back(t1);
61 }
62
63 ChebyshevU::GenerateFirstTwoTerms() {
64 DoublePolynomial u0;
65 u0.setCoefficient(0, 1.0);
66 polyList_.push_back(u0);
67
68 DoublePolynomial u1;
69 u1.setCoefficient(1, 2.0);
70 polyList_.push_back(u1);
71 }
72
73 } //end namespace oopse

Properties

Name Value
svn:executable *