OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
DynamicFixedPoint.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: DynamicFixedPoint.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: DynamicFixedPoint
10 // Find dynamic fixed point of a truncated power series map.
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/Vector.h"
25 #include "Algebra/VpsInvMap.h"
26 #include <cmath>
27 
28 
29 // Tolerance for fixed point search.
30 namespace {
31  const double tol = 1.0e-10;
32 }
33 
34 
35 // Class DynamicFixedPoint
36 // ------------------------------------------------------------------------
37 
39  fixedPoint(),
40  fixedPointMap()
41 
42 {}
43 
44 
46  fixedPoint(rhs.fixedPoint),
47  fixedPointMap(rhs.fixedPointMap)
48 {}
49 
50 
52  fixedPoint(Vector<double>(map.getDimension(), 0.0)),
53  fixedPointMap(map) {
54  int nDim = map.getDimension();
56 
57  while(true) {
58  // Get system of equations for fixed point.
61  double error = 0.0;
62 
63  for(int i = 0; i < nDim; i++) {
64  A(i, i) -= 1.0;
65  if(std::abs(Error(i)) > error) error = std::abs(Error(i));
66  }
67 
68  // Test for convergence.
69  if(error < tol) break;
70 
71  // Correction for fixed point.
72  LUMatrix<double> lu(A);
73  lu.backSubstitute(Error);
74  fixedPoint -= Error;
75 
76  // Build map around fixed point found so far.
78  }
79 }
80 
81 
83 {}
84 
85 
87  return fixedPoint;
88 }
89 
90 
92  return fixedPointMap;
93 }
94 
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Triangle decomposition of a matrix.
Definition: LUMatrix.h:44
int getDimension() const
Get dimension (number of Tps&lt;T&gt; components).
Definition: Vps.hpp:247
VpsInvMap< double > fixedPointMap
VpsMap< T > substitute(const VpsMap< T > &vv) const
Substitute.
Definition: VpsMap.h:221
Dynamic fix point of a map.
Matrix< T > linearTerms(const Vector< T > &y) const
Extract linear terms at point.
Definition: VpsMap.h:274
Vector< double > fixedPoint
const Vector< double > & getFixedPoint() const
Get fixed point transform.
static VpsInvMap< T > identity(int nVar)
Set to identity.
Definition: VpsInvMap.h:320
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
Vector.
const VpsInvMap< double > & getFixedPointMap() const
Get map around fixed point.