OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
RecursionRelationTwo.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018, Martin Duy Tat
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * 3. Neither the name of STFC nor the names of its contributors may be used to
12 * endorse or promote products derived from this software without specific
13 * prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef RECURSION_RELATION_TWO_H
29#define RECURSION_RELATION_TWO_H
30
54#include <vector>
56#include "PolynomialSum.h"
57#include "TwoPolynomial.h"
58
59namespace polynomial {
60
62public:
77 RecursionRelationTwo(const std::size_t &power,
78 const std::size_t &highestXorder);
86 void printOperator() const;
90 void truncate(std::size_t highestXorder);
92 void applyOperator();
94 void differentiateX();
96 void differentiateS();
98 std::size_t getMaxXDerivatives() const;
100 std::size_t getMaxSDerivatives() const;
111 double evaluatePolynomial(const double &x,
112 const double &s,
113 const std::size_t &xDerivative,
114 const std::size_t &sDerivative,
115 const std::vector<double> &dSvalues) const;
123 bool isPolynomialZero(const std::size_t &x,
124 const std::size_t &s,
125 const std::size_t &term) const;
129 void resizeX(const std::size_t &xDerivatives);
133 void resizeS(const std::size_t &sDerivatives);
140 std::size_t numberOfTerms(const std::size_t &xDerivative,
141 const std::size_t &sDerivative) const;
150 std::vector<std::size_t> getdSfactors(const std::size_t &xDerivative,
151 const std::size_t &sDerivative,
152 const std::size_t &p) const;
156 void sortTerms();
157private:
159 std::size_t power_m;
160 std::size_t highestXorder_m;
161};
162
163/*inline
164 void RecursionRelationTwo::printOperator() const {
165 operator_m.printOperator();
166}*/
167inline
168 void RecursionRelationTwo::truncate(std::size_t highestXorder) {
169 highestXorder_m = highestXorder;
170 operator_m.truncate(highestXorder);
171}
172inline
175}
176inline
179}
180inline
183}
184inline
187}
188inline
190 const double &x,
191 const double &s,
192 const std::size_t &xDerivative,
193 const std::size_t &sDerivative,
194 const std::vector<double> &dSvalues) const {
195 return operator_m.evaluatePolynomial(x, s,
196 xDerivative, sDerivative,
197 dSvalues);
198}
199inline
200 bool RecursionRelationTwo::isPolynomialZero(const std::size_t &x,
201 const std::size_t &s,
202 const std::size_t &term) const {
203 return operator_m.isPolynomialZero(x, s, term);
204}
205inline
206 void RecursionRelationTwo::resizeX(const std::size_t &xDerivatives) {
207 operator_m.resizeX(xDerivatives);
208}
209inline
210 void RecursionRelationTwo::resizeS(const std::size_t &sDerivatives) {
211 operator_m.resizeS(sDerivatives);
212}
213inline
215 const std::size_t &xDerivative,
216 const std::size_t &sDerivative) const {
217 return operator_m.numberOfTerms(xDerivative, sDerivative);
218}
219inline
220 std::vector<std::size_t> RecursionRelationTwo::getdSfactors(
221 const std::size_t &xDerivative,
222 const std::size_t &sDerivative,
223 const std::size_t &p) const {
224 return operator_m.getdSFactors(xDerivative, sDerivative, p);
225}
226inline
229}
230
231}
232
233#endif
bool isPolynomialZero(const std::size_t &x, const std::size_t &s, const std::size_t &term) const
double evaluatePolynomial(const double &x, const double &s, const std::size_t &xDerivative, const std::size_t &sDerivative, const std::vector< double > &dSvalues) const
void resizeX(const std::size_t &xDerivatives)
void truncate(const std::size_t &truncateOrder)
std::size_t numberOfTerms(const std::size_t &xDerivatives, const std::size_t &sDerivatives) const
std::vector< std::size_t > getdSFactors(const std::size_t &xDerivatives, const std::size_t &sDerivatives, const std::size_t &p) const
void resizeS(const std::size_t &sDerivatives)
void resizeS(const std::size_t &sDerivatives)
void truncate(std::size_t highestXorder)
std::size_t numberOfTerms(const std::size_t &xDerivative, const std::size_t &sDerivative) const
bool isPolynomialZero(const std::size_t &x, const std::size_t &s, const std::size_t &term) const
double evaluatePolynomial(const double &x, const double &s, const std::size_t &xDerivative, const std::size_t &sDerivative, const std::vector< double > &dSvalues) const
RecursionRelationTwo & operator=(const RecursionRelationTwo &recursion)
void resizeX(const std::size_t &xDerivatives)
std::vector< std::size_t > getdSfactors(const std::size_t &xDerivative, const std::size_t &sDerivative, const std::size_t &p) const