OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
TpsData.h
Go to the documentation of this file.
1 #ifndef CLASSIC_TpsData_H
2 #define CLASSIC_TpsData_H
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: TpsData.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: TpsData
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Algebra
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:32 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
23 #include "Algebra/Array1D.h"
24 #include "Algebra/Array2D.h"
25 #include "Algebra/TpsMonomial.h"
27 
28 
29 // Class TpsData
30 // ------------------------------------------------------------------------
32 // Internal utility class for Tps class.
33 // Not to be used directly in a program.
34 
35 class TpsData {
36 
37 public:
38 
39  TpsData();
40  ~TpsData();
41 
42  // Return the TpsData structure for "nVar" variables and order "nOrd".
43  static TpsData *getTpsData(int nOrd, int nVar);
44 
45  // Power array for monomial with index "index"
46  const TpsMonomial &getExponents(int index) const;
47 
48  // Order of monomial with index "index".
49  int getOrder(int index) const;
50 
51  // Index array for products of monomial "index".
52  const int *getProductArray(int index) const;
53 
54  // Number of terms in a Tps object of order "order"
55  int getSize(int order) const;
56 
57  // Number of terms in a Tps object of order "order"
59 
60  // Number of variables
61  int getVariables() const;
62 
63  // Index for a monomial from its exponents
64  int indexMonomial(const TpsMonomial &) const;
65 
66 private:
67 
68  // Not implemented.
69  TpsData(const TpsData &);
70  void operator=(const TpsData &);
71 
72  // TpsData builder.
73  void build(int max, int nVar);
74 
75  // Initialise TpsData to empty.
76  void clear();
77 
78  // Initialise Substitution tables.
79  void fillSubst(int var, int order, TpsMonomial &pow, int &next);
80 
81  // Number of variables.
82  int variables;
83 
84  // Maximum order to which the data are expanded.
85  int topOrder;
86 
87  // Maximum Tps size.
88  int maxSize;
89 
90  // Exponents: expon[index] = set of exponents in monomial "index".
93 
94  // Indexing information, used for Tps multiplication.
98 
99  // Binomial coefficients: binom[i-1][k]=(i+k) ! / i! / k!
100  // used in the indexMonomial() and getSize(int) methods.
103 
104  // The substitution table.
106 };
107 
108 
109 // Class TpsData, inline methods.
110 // ------------------------------------------------------------------------
111 
112 inline const TpsMonomial &TpsData::getExponents(int index) const
113 { return expon[index]; }
114 
115 
116 inline const int *TpsData::getProductArray(int index) const
117 { return prod[index].begin(); }
118 
119 
120 inline int TpsData::getOrder(int index) const
121 { return expon[index].getOrder(); }
122 
123 
124 inline int TpsData::getSize(int order) const
125 { return topOrder == 0 ? 1 : binom[0][order+1]; }
126 
127 
129 { return subTable; }
130 
131 
132 inline int TpsData::getVariables() const
133 { return variables; }
134 
135 #endif // CLASSIC_TpsData_H
Tps< T > pow(const Tps< T > &x, int y)
Integer power.
Definition: TpsMath.h:76
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:84
iterator begin()
Get beginning of data.
Definition: Array1D.h:204
Bookkeeping class for Tps<T>.
Definition: TpsData.h:35
const int * getProductArray(int index) const
Definition: TpsData.h:116
int getVariables() const
Definition: TpsData.h:132
static TpsData * getTpsData(int nOrd, int nVar)
Definition: TpsData.cpp:43
Array1D< int > ProductRow
Definition: TpsData.h:95
void operator=(const TpsData &)
void build(int max, int nVar)
Definition: TpsData.cpp:66
ProductTable prod
Definition: TpsData.h:97
Array2D< int > BinomialTable
Definition: TpsData.h:101
BinomialTable binom
Definition: TpsData.h:102
int variables
Definition: TpsData.h:82
void clear()
Definition: TpsData.cpp:147
int getOrder(int index) const
Definition: TpsData.h:120
int getSize(int order) const
Definition: TpsData.h:124
~TpsData()
Definition: TpsData.cpp:39
ExponentTable expon
Definition: TpsData.h:92
void fillSubst(int var, int order, TpsMonomial &pow, int &next)
Definition: TpsData.cpp:154
const Array1D< TpsSubstitution > & getSubTable() const
Definition: TpsData.h:128
Array1D< TpsMonomial > ExponentTable
Definition: TpsData.h:91
Array1D< TpsSubstitution > subTable
Definition: TpsData.h:105
int maxSize
Definition: TpsData.h:88
Array1D< ProductRow > ProductTable
Definition: TpsData.h:96
TpsData(const TpsData &)
TpsData()
Definition: TpsData.cpp:34
const TpsMonomial & getExponents(int index) const
Definition: TpsData.h:112
int topOrder
Definition: TpsData.h:85
int indexMonomial(const TpsMonomial &) const
Definition: TpsData.cpp:53
Exponent array for Tps<T>.
Definition: TpsMonomial.h:31