Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lyapunov.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __LYAPUNOV_H
25 #define __LYAPUNOV_H
26 
27 #include "matrix.h"
28 #include "stl_map.h"
29 
30 /**
31  * Class for calculating lyapunov exponents
32  * online, over several time horizons, from given Jacobi matrices
33 */
34 class Lyapunov {
35 public:
36  /// holds a matrix that is the result of a sliding window multiplication
37  struct SlidingMatrix {
38  /** @param dim dimension of the system (matrix is (dim x dim))
39  @param horizon for sliding window
40  */
41  SlidingMatrix(int dim, int horizon);
42  void step(int t, const matrix::Matrix* buffer,
43  const matrix::Matrix* invbuffer, int buffersize);
44  /** nominal size of sliding window
45  (if <=0 then infinite and absolute value stands for the size so far) */
46  int horizon;
47  matrix::Matrix M; ///< accumulated Matrix
48  matrix::Matrix Exp; ///< Lyapunov exponents
49  };
50 
51  typedef HashMap< int, SlidingMatrix* > Horizons;
52 
53 public:
54  Lyapunov();
55  ~Lyapunov();
56 
57  /** initializes with a set of horizons.
58  @param horizons for each horizon # in steps. 0 means infinite
59  @param dim # of dimensions (expect a (dim x dim) matrix in step)
60  */
61  void init(const std::list<int>& horizons, int dim);
62 
63  /** provides the current Jacobi matrix.
64  Internally the sliding windows and the exponents are generated
65  */
66  void step(const matrix::Matrix& jacobi);
67 
68  /** returns the lyapunov matrix at the given horizon
69  */
70  const matrix::Matrix& getLyapunovMatrix(int horizon);
71 
72  /** returns the lyapunov exponents at the given horizon
73  */
74  const matrix::Matrix& getLyapunovExp(int horizon);
75 
76 protected:
78  matrix::Matrix* invbuffer; // buffer for inverses
80  long int t;
81 
83 };
84 
85 
86 #endif
87 
Matrix type.
Definition: matrix.h:65
long int t
Definition: lyapunov.h:80
int horizon
nominal size of sliding window (if <=0 then infinite and absolute value stands for the size so far) ...
Definition: lyapunov.h:46
matrix::Matrix M
accumulated Matrix
Definition: lyapunov.h:47
SlidingMatrix(int dim, int horizon)
Definition: lyapunov.cpp:72
HashMap< int, SlidingMatrix * > Horizons
Definition: lyapunov.h:51
void step(const matrix::Matrix &jacobi)
provides the current Jacobi matrix.
Definition: lyapunov.cpp:63
matrix::Matrix * buffer
Definition: lyapunov.h:77
holds a matrix that is the result of a sliding window multiplication
Definition: lyapunov.h:37
~Lyapunov()
Definition: lyapunov.cpp:41
matrix::Matrix * invbuffer
Definition: lyapunov.h:78
Horizons horizons
Definition: lyapunov.h:82
void init(const std::list< int > &horizons, int dim)
initializes with a set of horizons.
Definition: lyapunov.cpp:49
Lyapunov()
Definition: lyapunov.cpp:34
const matrix::Matrix & getLyapunovExp(int horizon)
returns the lyapunov exponents at the given horizon
Definition: lyapunov.cpp:100
int buffersize
Definition: lyapunov.h:79
matrix::Matrix Exp
Lyapunov exponents.
Definition: lyapunov.h:48
Class for calculating lyapunov exponents online, over several time horizons, from given Jacobi matric...
Definition: lyapunov.h:34
void step(int t, const matrix::Matrix *buffer, const matrix::Matrix *invbuffer, int buffersize)
Definition: lyapunov.cpp:77
const matrix::Matrix & getLyapunovMatrix(int horizon)
returns the lyapunov matrix at the given horizon
Definition: lyapunov.cpp:90