OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
StaticFixedPoint.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: StaticFixedPoint.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class StaticFixedPoint:
10 // Fixed point for class Vps.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: Algebra
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:32 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
22 #include "Algebra/Matrix.h"
23 #include "Algebra/LUMatrix.h"
24 #include "Algebra/TpsMonomial.h"
25 #include "Algebra/Vector.h"
26 #include "Algebra/VpsInvMap.h"
27 #include <cmath>
28 
29 
30 // Tolerance for fixed point search.
31 namespace {
32  const double tol = 1.0e-10;
33 }
34 
35 
36 // Class StaticFixedPoint
37 // ------------------------------------------------------------------------
38 
40  fixedPoint(),
41  fixedPointMap()
42 {}
43 
44 
46  fixedPoint(fp.fixedPoint),
47  fixedPointMap(fp.fixedPointMap)
48 {}
49 
50 
52  fixedPoint(VpsInvMap<double>::identity(map.getDimension())),
53  fixedPointMap(map.getDimension()) {
54  const int nFree = 4;
55  const int nDim = map.getDimension();
57  Vector<double> fixPoint(nDim, 0.0);
58 
59  // Find fixed point;
60  // tempMap is the map around the fixed point.
61  VpsInvMap<double> tempMap(map);
62 
63  while(true) {
64  // Get system of equations for fixed point.
65  Matrix<double> A = tempMap.linearTerms();
66  Vector<double> Error = tempMap.constantTerm();
67  double error = 0.0;
68 
69  for(int i = 0; i < nFree; i++) {
70  A(i, i) -= 1.0;
71  if(std::abs(Error(i)) > error) error = std::abs(Error(i));
72  }
73 
74  for(int i = nFree; i < nDim; i++) {
75  for(int j = 0; j < nDim; j++) A(i, j) = A(j, i) = 0.0;
76  A(i, i) = 1.0;
77  Error(i) = 0.0;
78  }
79 
80  // Correction for fixed point.
81  lu = LUMatrix<double>(A);
82  lu.backSubstitute(Error);
83  fixPoint -= Error;
84 
85  // Test for convergence.
86  if(error < tol) break;
87 
88  // Build map around fixed point found so far.
89  tempMap = map.substitute(fixPoint + fixedPoint) - fixPoint;
90  }
91 
92  // Fixed point map for orders 1 and higher in delta (dispersion).
93  for(int limit = 1; limit <= map.getTopOrder(); limit++) {
94  // Remove pure delta terms.
97  TpsMonomial delta(nDim);
98  delta[nFree+1] = limit;
99  Vector<double> Error(nDim, 0.0);
100  for(int i = 0; i < nFree; i++) {
101  fixedPointMap[i] += Q[i].filter(limit, limit);
102  Error(i) = Q[i].getCoefficient(delta);
103  fixedPointMap[i].setCoefficient(delta, 0.0);
104  }
105 
106  lu.backSubstitute(Error);
107 
108  for(int i = 0; i < nFree; i += 2) {
109  // Effect on orbit.
110  fixedPoint[i].setCoefficient(delta, - Error(i));
111  fixedPoint[i+1].setCoefficient(delta, - Error(i + 1));
112 
113  // Orbit terms acting on path length difference.
114  TpsMonomial powers(nDim);
115  powers[nFree+1] = limit - 1;
116  powers[i] = 1;
117  fixedPoint[nFree].setCoefficient(powers, double(limit) * Error(i + 1));
118  powers[i] = 0;
119  powers[i+1] = 1;
120  fixedPoint[nFree].setCoefficient(powers, - double(limit) * Error(i));
121  powers[i+1] = 0;
122  }
123 
124  // Path length term in delta^limit.
125  fixedPoint[nFree].
126  setCoefficient(delta, Q[nFree].getCoefficient(delta));
127  }
128 
129  // Fill in path length terms and identity for delta(p)/p.
130  fixedPointMap[nFree+1] = Tps<double>::makeVariable(nDim, nFree + 1);
131  fixedPointMap[nFree] =
133 
134  // Combine fixed point and dispersion.
135  fixedPoint += fixPoint;
136 }
137 
138 
140 {}
141 
142 
144  return fixedPoint;
145 }
146 
147 
149  return fixedPointMap;
150 }
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Triangle decomposition of a matrix.
Definition: LUMatrix.h:44
Static fixed point of a map.
int getDimension() const
Get dimension (number of Tps&lt;T&gt; components).
Definition: Vps.hpp:247
const VpsInvMap< double > & getFixedPointMap() const
Get map around fixed point.
int getTopOrder() const
Get highest order contained in any component.
Definition: Vps.hpp:253
Vps< T > filter(int lowOrder, int highOrder) const
Extract range of orders, set others to zero.
Definition: Vps.hpp:286
VpsInvMap< T > inverse() const
Inverse.
Definition: VpsInvMap.h:295
VpsInvMap< double > fixedPoint
VpsMap< T > substitute(const VpsMap< T > &vv) const
Substitute.
Definition: VpsMap.h:221
Matrix< T > linearTerms(const Vector< T > &y) const
Extract linear terms at point.
Definition: VpsMap.h:274
const VpsInvMap< double > & getFixedPoint() const
Get the transformation to the fixed point.
Exponent array for Tps&lt;T&gt;.
Definition: TpsMonomial.h:31
static Tps< T > makeVariable(int nVar, int var)
Make variable.
Definition: Tps.hpp:383
void backSubstitute(Vector< T > &B) const
Back substitution.
Definition: LUMatrix.h:229
Vector< T > constantTerm(const Vector< T > &y) const
Evaluate map at point.
Definition: VpsMap.h:233
VpsInvMap< double > fixedPointMap