aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chaos/src/bernoulli_map.hpp7
-rw-r--r--chaos/src/bungalow_tent_map.hpp7
-rw-r--r--chaos/src/chaos.hpp1
-rw-r--r--chaos/src/chaos_base.hpp24
-rw-r--r--chaos/src/chaos_dsp.hpp10
-rw-r--r--chaos/src/chua.hpp10
-rw-r--r--chaos/src/circle_map.hpp5
-rw-r--r--chaos/src/coupled_logistic.hpp7
-rw-r--r--chaos/src/delayed_logistic.hpp8
-rw-r--r--chaos/src/driven_anharmonic.hpp9
-rw-r--r--chaos/src/driven_van_der_pol.hpp10
-rw-r--r--chaos/src/duffing_map.hpp7
-rw-r--r--chaos/src/gauss_map.hpp7
-rw-r--r--chaos/src/gaussian_map.hpp7
-rw-r--r--chaos/src/henon_map.hpp7
-rw-r--r--chaos/src/hydrogen.hpp8
-rw-r--r--chaos/src/ikeda_laser_map.hpp8
-rw-r--r--chaos/src/latoocarfian.hpp8
-rw-r--r--chaos/src/latoomutalpha.hpp7
-rw-r--r--chaos/src/latoomutbeta.hpp7
-rw-r--r--chaos/src/latoomutgamma.hpp7
-rw-r--r--chaos/src/linear_congruental.hpp68
-rw-r--r--chaos/src/linear_congruental_dsp.cpp23
-rw-r--r--chaos/src/linear_congruental_msg.cpp23
-rw-r--r--chaos/src/linear_congruental_search.cpp24
-rw-r--r--chaos/src/logistic_map.hpp8
-rw-r--r--chaos/src/lorenz.hpp11
-rw-r--r--chaos/src/lozi_map.hpp7
-rw-r--r--chaos/src/main.cpp5
-rw-r--r--chaos/src/map_base.hpp5
-rw-r--r--chaos/src/ode_base.hpp41
-rw-r--r--chaos/src/roessler.hpp10
-rw-r--r--chaos/src/sine_map.hpp7
-rw-r--r--chaos/src/standard_map.hpp7
-rw-r--r--chaos/src/tent_map.hpp11
35 files changed, 234 insertions, 187 deletions
diff --git a/chaos/src/bernoulli_map.hpp b/chaos/src/bernoulli_map.hpp
index 31db7f7..f084c67 100644
--- a/chaos/src/bernoulli_map.hpp
+++ b/chaos/src/bernoulli_map.hpp
@@ -29,13 +29,10 @@ class bernoulli:
{
public:
- bernoulli()
+ bernoulli():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x,0.5,0);
-
- CHAOS_POSTCONSTRUCTOR;
}
~bernoulli()
diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp
index 5da431d..4d4836b 100644
--- a/chaos/src/bungalow_tent_map.hpp
+++ b/chaos/src/bungalow_tent_map.hpp
@@ -36,14 +36,11 @@ class bungalow_tent:
public map_base
{
public:
- bungalow_tent()
+ bungalow_tent():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x, 0.6,0);
CHAOS_PAR_INIT(r, 0.5);
-
- CHAOS_POSTCONSTRUCTOR;
}
~bungalow_tent()
diff --git a/chaos/src/chaos.hpp b/chaos/src/chaos.hpp
index 2e2eb8b..bb9971d 100644
--- a/chaos/src/chaos.hpp
+++ b/chaos/src/chaos.hpp
@@ -24,6 +24,7 @@
#define _USE_MATH_DEFINES /* tg says: define this before including cmath */
#include "flext.h"
+#include "assert.h"
#include "chaos_defs.hpp"
#include <cmath>
diff --git a/chaos/src/chaos_base.hpp b/chaos/src/chaos_base.hpp
index 5e2a99f..5c87bed 100644
--- a/chaos/src/chaos_base.hpp
+++ b/chaos/src/chaos_base.hpp
@@ -27,14 +27,20 @@
class chaos_base
{
-
public:
+ chaos_base(int n):
+ m_num_eq(n)
+ {
+ m_data = new data_t[n];
+ }
+
+
inline t_sample get_data(unsigned int i)
{
return (t_sample)m_data[i]; /* this is not save, but fast */
}
- inline int get_num_eq()
+ inline int get_num_eq() const
{
return m_num_eq;
}
@@ -65,25 +71,15 @@ public:
}
};
- data_t m_data[MAXDIMENSION]; // state of the system
+ data_t * m_data; // state of the system
protected:
virtual void m_step() = 0; // iteration
- int m_num_eq; // number of equations of the system
+ const int m_num_eq; // number of equations of the system
flext::AtomList Parameter; // parameter
flext::AtomList System; // system
};
-#define CHAOS_PRECONSTRUCTOR \
- /* dummy */
-
-#define CHAOS_POSTCONSTRUCTOR \
-m_num_eq = System.Count();
-
-#define CHAOS_DESTRUCTOR \
-
-
-
#define CHAOS_CALLBACKS \
public: \
void get_dimension(int &i) \
diff --git a/chaos/src/chaos_dsp.hpp b/chaos/src/chaos_dsp.hpp
index 78c4130..e86fc30 100644
--- a/chaos/src/chaos_dsp.hpp
+++ b/chaos/src/chaos_dsp.hpp
@@ -236,11 +236,11 @@ SYSTEM##_dsp(int argc, t_atom* argv ) \
~SYSTEM##_dsp() \
{ \
delete m_system; \
- delete m_values; \
- delete m_slopes; \
- delete m_nextvalues; \
- delete m_nextmidpts; \
- delete m_curves; \
+ delete[] m_values; \
+ delete[] m_slopes; \
+ delete[] m_nextvalues; \
+ delete[] m_nextmidpts; \
+ delete[] m_curves; \
} \
\
FLEXT_ATTRVAR_F(m_freq); \
diff --git a/chaos/src/chua.hpp b/chaos/src/chua.hpp
index 3d44708..997116c 100644
--- a/chaos/src/chua.hpp
+++ b/chaos/src/chua.hpp
@@ -34,10 +34,9 @@ class chua:
public ode_base
{
public:
- chua()
+ chua():
+ ode_base(3)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,2);
CHAOS_PAR_INIT(dt,0.05);
@@ -49,15 +48,10 @@ public:
CHAOS_PAR_INIT(b,30);
CHAOS_PAR_INIT(alpha,30);
CHAOS_PAR_INIT(beta,30);
-
- CHAOS_POSTCONSTRUCTOR;
-
- ode_base_alloc();
}
~chua()
{
- ode_base_free();
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/circle_map.hpp b/chaos/src/circle_map.hpp
index b6442a8..0a52993 100644
--- a/chaos/src/circle_map.hpp
+++ b/chaos/src/circle_map.hpp
@@ -31,15 +31,12 @@ class circle_map:
{
public:
circle_map()
+ : map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x, 0.4,0);
CHAOS_PAR_INIT(omega, 0.1);
CHAOS_PAR_INIT(r, 3);
-
- CHAOS_POSTCONSTRUCTOR;
}
~circle_map()
diff --git a/chaos/src/coupled_logistic.hpp b/chaos/src/coupled_logistic.hpp
index d94ceee..2e4b160 100644
--- a/chaos/src/coupled_logistic.hpp
+++ b/chaos/src/coupled_logistic.hpp
@@ -29,17 +29,14 @@ class coupled_logistic:
public map_base
{
public:
- coupled_logistic()
+ coupled_logistic():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(e, 0.06);
CHAOS_PAR_INIT(r, 3.7);
CHAOS_SYS_INIT(x, 0.1,0);
CHAOS_SYS_INIT(y, 0.2,1);
-
- CHAOS_POSTCONSTRUCTOR;
}
~coupled_logistic()
diff --git a/chaos/src/delayed_logistic.hpp b/chaos/src/delayed_logistic.hpp
index c78785f..47360e7 100644
--- a/chaos/src/delayed_logistic.hpp
+++ b/chaos/src/delayed_logistic.hpp
@@ -29,16 +29,12 @@ class delayed_logistic:
public map_base
{
public:
- delayed_logistic()
+ delayed_logistic():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x, 0.5, 0);
-
CHAOS_PAR_INIT(alpha, 3.8);
- CHAOS_POSTCONSTRUCTOR;
-
m_delayed = get_x(); /* the initial state of the delay */
}
diff --git a/chaos/src/driven_anharmonic.hpp b/chaos/src/driven_anharmonic.hpp
index 16e053b..2d72071 100644
--- a/chaos/src/driven_anharmonic.hpp
+++ b/chaos/src/driven_anharmonic.hpp
@@ -32,10 +32,9 @@ class driven_anharmonic
: public ode_base
{
public:
- driven_anharmonic()
+ driven_anharmonic():
+ ode_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,0);
CHAOS_PAR_INIT(dt,0.01);
@@ -49,15 +48,11 @@ public:
CHAOS_PAR_INIT(k1,0.01);
CHAOS_PAR_INIT(k2,1);
- CHAOS_POSTCONSTRUCTOR;
- ode_base_alloc();
m_t = 0;
}
~driven_anharmonic()
{
- ode_base_free();
-
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/driven_van_der_pol.hpp b/chaos/src/driven_van_der_pol.hpp
index 6156eb0..e538185 100644
--- a/chaos/src/driven_van_der_pol.hpp
+++ b/chaos/src/driven_van_der_pol.hpp
@@ -33,10 +33,9 @@ class driven_van_der_pol
: public ode_base
{
public:
- driven_van_der_pol()
+ driven_van_der_pol():
+ ode_base(3)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,2);
CHAOS_PAR_INIT(dt,0.01);
@@ -47,15 +46,10 @@ public:
CHAOS_PAR_INIT(a,5);
CHAOS_PAR_INIT(Omega,2.466);
CHAOS_PAR_INIT(k,5);
-
- CHAOS_POSTCONSTRUCTOR;
- ode_base_alloc();
}
~driven_van_der_pol()
{
- ode_base_free();
-
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/duffing_map.hpp b/chaos/src/duffing_map.hpp
index 5110873..f0e3001 100644
--- a/chaos/src/duffing_map.hpp
+++ b/chaos/src/duffing_map.hpp
@@ -29,16 +29,13 @@ class duffing_map:
public map_base
{
public:
- duffing_map()
+ duffing_map():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x1, 0.5, 0);
CHAOS_SYS_INIT(x2, 0.5, 1);
CHAOS_PAR_INIT(a, 0.5);
CHAOS_PAR_INIT(b, 0.5);
-
- CHAOS_POSTCONSTRUCTOR;
}
~duffing_map()
diff --git a/chaos/src/gauss_map.hpp b/chaos/src/gauss_map.hpp
index 1e023d2..641b93a 100644
--- a/chaos/src/gauss_map.hpp
+++ b/chaos/src/gauss_map.hpp
@@ -31,13 +31,10 @@ class gauss_map:
public map_base
{
public:
- gauss_map()
+ gauss_map():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x,0.5, 0);
-
- CHAOS_POSTCONSTRUCTOR;
}
~gauss_map()
diff --git a/chaos/src/gaussian_map.hpp b/chaos/src/gaussian_map.hpp
index 5f5a4b1..9b2b8ca 100644
--- a/chaos/src/gaussian_map.hpp
+++ b/chaos/src/gaussian_map.hpp
@@ -29,16 +29,13 @@ class gaussian_map:
public map_base
{
public:
- gaussian_map()
+ gaussian_map():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x, 0.5, 0);
CHAOS_PAR_INIT(b,7);
CHAOS_PAR_INIT(c,0.5);
-
- CHAOS_POSTCONSTRUCTOR;
}
~gaussian_map()
diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp
index 73aed66..bb1c6c7 100644
--- a/chaos/src/henon_map.hpp
+++ b/chaos/src/henon_map.hpp
@@ -29,17 +29,14 @@ class henon:
public map_base
{
public:
- henon()
+ henon():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x,0,0);
CHAOS_SYS_INIT(y,0,1);
CHAOS_PAR_INIT(a,1.4);
CHAOS_PAR_INIT(b,0.3);
-
- CHAOS_POSTCONSTRUCTOR;
}
~henon()
diff --git a/chaos/src/hydrogen.hpp b/chaos/src/hydrogen.hpp
index 886539c..6df6088 100644
--- a/chaos/src/hydrogen.hpp
+++ b/chaos/src/hydrogen.hpp
@@ -29,10 +29,9 @@ class hydrogen
public:
- hydrogen()
+ hydrogen():
+ ode_base(4)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,2);
CHAOS_PAR_INIT(dt,0.01);
@@ -43,14 +42,11 @@ public:
CHAOS_PAR_INIT(etilde,-0.3);
- CHAOS_POSTCONSTRUCTOR;
- ode_base_alloc();
reset = 0;
}
~hydrogen()
{
- ode_base_free();
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp
index ece0b9f..3c4d587 100644
--- a/chaos/src/ikeda_laser_map.hpp
+++ b/chaos/src/ikeda_laser_map.hpp
@@ -35,10 +35,9 @@ class ikeda_laser_map:
public map_base
{
public:
- ikeda_laser_map()
+ ikeda_laser_map():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(c1,0.4);
CHAOS_PAR_INIT(c2,0.9);
CHAOS_PAR_INIT(c3,9);
@@ -46,13 +45,10 @@ public:
CHAOS_SYS_INIT(x,0.5,0);
CHAOS_SYS_INIT(y,0.5,1);
-
- CHAOS_POSTCONSTRUCTOR;
}
~ikeda_laser_map()
{
-
}
virtual void m_step()
diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp
index 9bfba90..eec6116 100644
--- a/chaos/src/latoocarfian.hpp
+++ b/chaos/src/latoocarfian.hpp
@@ -31,10 +31,9 @@ class latoocarfian
: public map_base
{
public:
- latoocarfian()
+ latoocarfian():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR
-
CHAOS_SYS_INIT(x1,0.5,0);
CHAOS_SYS_INIT(x2,0,1);
@@ -42,13 +41,10 @@ public:
CHAOS_PAR_INIT(b,2.879879);
CHAOS_PAR_INIT(c,0.765145);
CHAOS_PAR_INIT(d,0.744728);
-
- CHAOS_POSTCONSTRUCTOR;
}
~latoocarfian()
{
-
}
virtual void m_step()
diff --git a/chaos/src/latoomutalpha.hpp b/chaos/src/latoomutalpha.hpp
index ff0cf9f..ac4f28d 100644
--- a/chaos/src/latoomutalpha.hpp
+++ b/chaos/src/latoomutalpha.hpp
@@ -30,18 +30,15 @@ class latoomutalpha
: public map_base
{
public:
- latoomutalpha()
+ latoomutalpha():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x1,0.5,0);
CHAOS_SYS_INIT(x2,0.2,1);
CHAOS_PAR_INIT(a,-0.966918);
CHAOS_PAR_INIT(b,2.879879);
CHAOS_PAR_INIT(c,0.765145);
-
- CHAOS_POSTCONSTRUCTOR;
}
~latoomutalpha()
diff --git a/chaos/src/latoomutbeta.hpp b/chaos/src/latoomutbeta.hpp
index a3562c8..3a048cd 100644
--- a/chaos/src/latoomutbeta.hpp
+++ b/chaos/src/latoomutbeta.hpp
@@ -30,17 +30,14 @@ class latoomutbeta
: public map_base
{
public:
- latoomutbeta()
+ latoomutbeta():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x1,0.5,0);
CHAOS_SYS_INIT(x2,0.5,1);
CHAOS_PAR_INIT(a,-0.966918);
CHAOS_PAR_INIT(b,2.879879);
-
- CHAOS_POSTCONSTRUCTOR;
}
~latoomutbeta()
diff --git a/chaos/src/latoomutgamma.hpp b/chaos/src/latoomutgamma.hpp
index daf3608..5e55225 100644
--- a/chaos/src/latoomutgamma.hpp
+++ b/chaos/src/latoomutgamma.hpp
@@ -30,17 +30,14 @@ class latoomutgamma
: public map_base
{
public:
- latoomutgamma()
+ latoomutgamma():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x1,0.5,0);
CHAOS_SYS_INIT(x2,0.5,1);
CHAOS_PAR_INIT(a,-0.966918);
CHAOS_PAR_INIT(b,2.879879);
-
- CHAOS_POSTCONSTRUCTOR;
}
~latoomutgamma()
diff --git a/chaos/src/linear_congruental.hpp b/chaos/src/linear_congruental.hpp
new file mode 100644
index 0000000..bc3536a
--- /dev/null
+++ b/chaos/src/linear_congruental.hpp
@@ -0,0 +1,68 @@
+//
+//
+// chaos~
+// Copyright (C) 2004 Tim Blechmann
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+#include "map_base.hpp"
+
+// tent map: x[n+1] = A*x[n] + B mod C
+//
+// taken from Julien C. Sprott, Chaos and Time-Series Analysis
+
+class linear_congruental:
+ public map_base
+{
+public:
+ linear_congruental():
+ map_base(1)
+ {
+ CHAOS_SYS_INIT(x, 0, 0);
+
+ CHAOS_PAR_INIT(A, 1741);
+ CHAOS_PAR_INIT(B, 54773);
+ CHAOS_PAR_INIT(C, 259200);
+ }
+
+ virtual void m_step()
+ {
+ data_t x = m_data[0];
+
+ m_data[0] = chaos_mod( CHAOS_PARAMETER(A) * x + CHAOS_PARAMETER(B), CHAOS_PARAMETER(C));
+ }
+
+ CHAOS_SYSVAR_FUNCS(x,0);
+
+ CHAOS_SYSPAR_FUNCS(A);
+ CHAOS_SYSPAR_FUNCS(B);
+ CHAOS_SYSPAR_FUNCS(C);
+};
+
+#define LINEAR_CONGRUENTAL_CALLBACKS \
+MAP_CALLBACKS; \
+CHAOS_SYS_CALLBACKS(A); \
+CHAOS_SYS_CALLBACKS(B); \
+CHAOS_SYS_CALLBACKS(C); \
+CHAOS_SYS_CALLBACKS(x);
+
+#define LINEAR_CONGRUENTAL_ATTRIBUTES \
+MAP_ATTRIBUTES; \
+CHAOS_SYS_ATTRIBUTE(A); \
+CHAOS_SYS_ATTRIBUTE(B); \
+CHAOS_SYS_ATTRIBUTE(C); \
+CHAOS_SYS_ATTRIBUTE(x);
+
diff --git a/chaos/src/linear_congruental_dsp.cpp b/chaos/src/linear_congruental_dsp.cpp
new file mode 100644
index 0000000..df36059
--- /dev/null
+++ b/chaos/src/linear_congruental_dsp.cpp
@@ -0,0 +1,23 @@
+//
+//
+// chaos~
+// Copyright (C) 2005 Tim Blechmann
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+#include "linear_congruental.hpp"
+#include "chaos_dsp.hpp"
+CHAOS_DSP_CLASS(linear_congruental,LINEAR_CONGRUENTAL);
diff --git a/chaos/src/linear_congruental_msg.cpp b/chaos/src/linear_congruental_msg.cpp
new file mode 100644
index 0000000..5b15d99
--- /dev/null
+++ b/chaos/src/linear_congruental_msg.cpp
@@ -0,0 +1,23 @@
+//
+//
+// chaos~
+// Copyright (C) 2005 Tim Blechmann
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+#include "linear_congruental.hpp"
+#include "chaos_msg.hpp"
+CHAOS_MSG_CLASS(linear_congruental,LINEAR_CONGRUENTAL);
diff --git a/chaos/src/linear_congruental_search.cpp b/chaos/src/linear_congruental_search.cpp
new file mode 100644
index 0000000..f3a09a2
--- /dev/null
+++ b/chaos/src/linear_congruental_search.cpp
@@ -0,0 +1,24 @@
+//
+//
+// chaos~
+// Copyright (C) 2005 Tim Blechmann
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+#include "linear_congruental.hpp"
+#include "chaos_search.hpp"
+
+CHAOS_SEARCH_CLASS(linear_congruental, LINEAR_CONGRUENTAL);
diff --git a/chaos/src/logistic_map.hpp b/chaos/src/logistic_map.hpp
index c01abcc..3e0ef24 100644
--- a/chaos/src/logistic_map.hpp
+++ b/chaos/src/logistic_map.hpp
@@ -28,19 +28,15 @@ class logistic:
public map_base
{
public:
- logistic()
+ logistic():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(alpha, 3.8);
CHAOS_SYS_INIT(x, 0.5,0);
-
- CHAOS_POSTCONSTRUCTOR;
}
~logistic()
{
- delete m_data;
}
virtual void m_step()
diff --git a/chaos/src/lorenz.hpp b/chaos/src/lorenz.hpp
index e94f027..b27f954 100644
--- a/chaos/src/lorenz.hpp
+++ b/chaos/src/lorenz.hpp
@@ -29,10 +29,9 @@ class lorenz
: public ode_base
{
public:
- lorenz()
+ lorenz():
+ ode_base(3)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,0);
CHAOS_PAR_INIT(dt,0.01);
@@ -43,16 +42,10 @@ public:
CHAOS_PAR_INIT(sigma,16);
CHAOS_PAR_INIT(b,4);
CHAOS_PAR_INIT(r,40);
-
- CHAOS_POSTCONSTRUCTOR;
-
- ode_base_alloc();
}
~lorenz()
{
- ode_base_free();
-
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/lozi_map.hpp b/chaos/src/lozi_map.hpp
index b30a95b..dee6b0d 100644
--- a/chaos/src/lozi_map.hpp
+++ b/chaos/src/lozi_map.hpp
@@ -29,17 +29,14 @@ class lozi_map:
public map_base
{
public:
- lozi_map()
+ lozi_map():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x,0,0);
CHAOS_SYS_INIT(y,0,1);
CHAOS_PAR_INIT(a,1.4);
CHAOS_PAR_INIT(b,0.3);
-
- CHAOS_POSTCONSTRUCTOR;
}
~lozi_map()
diff --git a/chaos/src/main.cpp b/chaos/src/main.cpp
index 53bd62e..0126f32 100644
--- a/chaos/src/main.cpp
+++ b/chaos/src/main.cpp
@@ -23,7 +23,8 @@
void chaos_library_setup()
{
- post("chaos~ version 0.01, compiled on "__DATE__" \n");
+ post("chaos~ version 0.01, compiled on "__DATE__);
+ post("(C)2005 Tim Blechmann, www.mokabar.tk\n\n");
CHAOS_ADD(bernoulli);
@@ -34,6 +35,7 @@ void chaos_library_setup()
CHAOS_ADD(delayed_logistic);
CHAOS_ADD(driven_anharmonic);
CHAOS_ADD(driven_van_der_pol);
+ CHAOS_ADD(duffing);
CHAOS_ADD(duffing_map);
CHAOS_ADD(gauss_map);
CHAOS_ADD(gaussian_map);
@@ -44,6 +46,7 @@ void chaos_library_setup()
CHAOS_ADD(latoomutalpha);
CHAOS_ADD(latoomutbeta);
CHAOS_ADD(latoomutgamma);
+ CHAOS_ADD(linear_congruental);
CHAOS_ADD(logistic);
CHAOS_ADD(lorenz);
CHAOS_ADD(lozi_map);
diff --git a/chaos/src/map_base.hpp b/chaos/src/map_base.hpp
index e71fe61..1395bb8 100644
--- a/chaos/src/map_base.hpp
+++ b/chaos/src/map_base.hpp
@@ -27,6 +27,11 @@ class map_base
: public chaos_base
{
protected:
+ map_base(int n):
+ chaos_base(n)
+ {
+ }
+
virtual void m_step()
{
}
diff --git a/chaos/src/ode_base.hpp b/chaos/src/ode_base.hpp
index b7139d2..11811f7 100644
--- a/chaos/src/ode_base.hpp
+++ b/chaos/src/ode_base.hpp
@@ -27,6 +27,26 @@ class ode_base
: public chaos_base
{
public:
+ ode_base(int n):
+ chaos_base (n)
+ {
+ for (int i = 0; i != 3; ++i)
+ {
+ m_k[i] = new data_t[n];
+ }
+ m_tmp = new data_t[n];
+
+ }
+
+ ~ode_base()
+ {
+ for (int i = 0; i != 3; ++i)
+ {
+ delete[] m_k[i];
+ }
+ delete[] m_tmp;
+ }
+
void set_method(int i)
{
if (i >=0 && i <4)
@@ -65,27 +85,6 @@ public:
(this->*m_routine)();
}
- void ode_base_alloc()
- {
- int dimension = get_num_eq();
-
- for (int i = 0; i != 3; ++i)
- {
- m_k[i] = new data_t[dimension];
- }
-
- m_tmp = new data_t[dimension];
- }
-
- void ode_base_free()
- {
- for (int i = 0; i != 3; ++i)
- {
- delete m_k[i];
- }
- delete m_tmp;
- }
-
protected:
void (ode_base::*m_routine)(void);
diff --git a/chaos/src/roessler.hpp b/chaos/src/roessler.hpp
index e2c55e0..fd65d4e 100644
--- a/chaos/src/roessler.hpp
+++ b/chaos/src/roessler.hpp
@@ -29,10 +29,9 @@ class roessler
: public ode_base
{
public:
- roessler()
+ roessler():
+ ode_base(3)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_PAR_INIT(method,0);
CHAOS_PAR_INIT(dt,0.001);
@@ -43,15 +42,10 @@ public:
CHAOS_PAR_INIT(a,4);
CHAOS_PAR_INIT(b,4);
CHAOS_PAR_INIT(c,4);
-
- CHAOS_POSTCONSTRUCTOR;
- ode_base_alloc();
}
~roessler()
{
- ode_base_free();
-
}
virtual void m_system(data_t* deriv, data_t* data)
diff --git a/chaos/src/sine_map.hpp b/chaos/src/sine_map.hpp
index 21c7e39..3d69065 100644
--- a/chaos/src/sine_map.hpp
+++ b/chaos/src/sine_map.hpp
@@ -30,13 +30,10 @@ class sine_map:
{
public:
- sine_map()
+ sine_map():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x,0,0);
-
- CHAOS_POSTCONSTRUCTOR;
}
~sine_map()
diff --git a/chaos/src/standard_map.hpp b/chaos/src/standard_map.hpp
index 663280a..4df1eb9 100644
--- a/chaos/src/standard_map.hpp
+++ b/chaos/src/standard_map.hpp
@@ -30,16 +30,13 @@ class standard_map:
public map_base
{
public:
- standard_map()
+ standard_map():
+ map_base(2)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(I,0.1,0);
CHAOS_SYS_INIT(theta,0.2,1);
CHAOS_PAR_INIT(k, 0.8);
-
- CHAOS_POSTCONSTRUCTOR;
}
~standard_map()
diff --git a/chaos/src/tent_map.hpp b/chaos/src/tent_map.hpp
index e23fb73..9bd8e62 100644
--- a/chaos/src/tent_map.hpp
+++ b/chaos/src/tent_map.hpp
@@ -29,15 +29,12 @@ class tent_map:
public map_base
{
public:
- tent_map()
+ tent_map():
+ map_base(1)
{
- CHAOS_PRECONSTRUCTOR;
-
CHAOS_SYS_INIT(x, 0.6,0);
-
- CHAOS_POSTCONSTRUCTOR;
}
-
+
~tent_map()
{
@@ -49,7 +46,7 @@ public:
m_data[0] = 1 - 2*CHAOS_ABS(data);
}
-
+
CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred_x);
bool m_pred_x(t_float f)
{