aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chaos/src/Makefile.am4
-rw-r--r--chaos/src/bernoulli_map.hpp11
-rw-r--r--chaos/src/bungalow_tent_map.hpp12
-rw-r--r--chaos/src/chaos_base.hpp26
-rw-r--r--chaos/src/chaos_defs.hpp43
-rw-r--r--chaos/src/chaos_dsp.hpp138
-rw-r--r--chaos/src/chua.hpp22
-rw-r--r--chaos/src/circle_map.hpp15
-rw-r--r--chaos/src/coupled_logistic.hpp38
-rw-r--r--chaos/src/driven_anharmonic.hpp26
-rw-r--r--chaos/src/driven_van_der_pol.hpp22
-rw-r--r--chaos/src/duffing_map.hpp16
-rw-r--r--chaos/src/gauss_map.hpp10
-rw-r--r--chaos/src/henon_map.hpp16
-rw-r--r--chaos/src/ikeda_laser_map.hpp21
-rw-r--r--chaos/src/latoocarfian.hpp20
-rw-r--r--chaos/src/latoomutalpha.hpp20
-rw-r--r--chaos/src/latoomutbeta.hpp16
-rw-r--r--chaos/src/latoomutgamma.hpp16
-rw-r--r--chaos/src/logistic_map.hpp10
-rw-r--r--chaos/src/lorenz.hpp25
-rw-r--r--chaos/src/lozi_map.hpp24
-rw-r--r--chaos/src/main.cpp2
-rw-r--r--chaos/src/roessler.hpp24
-rw-r--r--chaos/src/sine_map.hpp10
-rw-r--r--chaos/src/standard_map.hpp14
-rw-r--r--chaos/src/tent_map.hpp10
27 files changed, 371 insertions, 240 deletions
diff --git a/chaos/src/Makefile.am b/chaos/src/Makefile.am
index 2b87927..e85310c 100644
--- a/chaos/src/Makefile.am
+++ b/chaos/src/Makefile.am
@@ -16,13 +16,13 @@ BUILT_SOURCES = main.cpp ode_base.cpp chaos_dsp.cpp \
latoomutalpha_dsp.cpp latoomutalpha_msg.cpp \
latoomutbeta_dsp.cpp latoomutbeta_msg.cpp \
latoomutgamma_dsp.cpp latoomutgamma_msg.cpp \
- logistic_dsp.cpp logistic_msg.cpp \
+ logistic_dsp.cpp logistic_msg.cpp logistic_search.cpp\
lorenz_dsp.cpp lorenz_msg.cpp \
lozi_map_dsp.cpp lozi_map_msg.cpp \
roessler_dsp.cpp roessler_msg.cpp \
sine_map_dsp.cpp sine_map_msg.cpp \
standard_map_dsp.cpp standard_map_msg.cpp \
- tent_map_dsp.cpp tent_map_msg.cpp
+ tent_map_dsp.cpp tent_map_msg.cpp
CXXFLAGS = @CXXFLAGS@ \
@OPT_FLAGS@ \
diff --git a/chaos/src/bernoulli_map.hpp b/chaos/src/bernoulli_map.hpp
index 821f24f..31db7f7 100644
--- a/chaos/src/bernoulli_map.hpp
+++ b/chaos/src/bernoulli_map.hpp
@@ -28,16 +28,19 @@ class bernoulli:
public map_base
{
public:
+
bernoulli()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x,0.5);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x,0.5,0);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~bernoulli()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp
index 0dfe709..5da431d 100644
--- a/chaos/src/bungalow_tent_map.hpp
+++ b/chaos/src/bungalow_tent_map.hpp
@@ -38,15 +38,17 @@ class bungalow_tent:
public:
bungalow_tent()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x, 0.6);
- CHAOS_SYS_INIT(r, 0.5);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x, 0.6,0);
+ CHAOS_PAR_INIT(r, 0.5);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~bungalow_tent()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/chaos_base.hpp b/chaos/src/chaos_base.hpp
index 3e11201..959afdf 100644
--- a/chaos/src/chaos_base.hpp
+++ b/chaos/src/chaos_base.hpp
@@ -21,6 +21,9 @@
#ifndef __chaos_base_hpp
#include "chaos.hpp"
+#include <map>
+
+#define MAXDIMENSION 5 // this should be enough for the first
class chaos_base
{
@@ -42,6 +45,9 @@ public:
m_verify();
}
+ std::map<const t_symbol*,int> attr_ind;
+
+ // check the integrity of the system
virtual void m_verify()
{
for (int i = 0; i != get_num_eq(); ++i)
@@ -52,14 +58,25 @@ public:
#endif
}
};
-
- data_t * m_data; // state of the system
+
+ data_t m_data[MAXDIMENSION]; // state of the system
protected:
- virtual void m_step() = 0;
- int m_num_eq; // number of equations of the system
+ virtual void m_step() = 0; // iteration
+ 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: \
@@ -69,6 +86,7 @@ void get_dimension(int &i) \
} \
FLEXT_CALLGET_I(get_dimension);
+
#define CHAOS_ATTRIBUTES \
FLEXT_ADDATTR_GET("dimension",get_dimension);
diff --git a/chaos/src/chaos_defs.hpp b/chaos/src/chaos_defs.hpp
index 08c47d4..d9f60d8 100644
--- a/chaos/src/chaos_defs.hpp
+++ b/chaos/src/chaos_defs.hpp
@@ -124,9 +124,24 @@ FLEXT_CALLVAR_I(get_##NAME, set_##NAME);
#define CHAOS_SYS_ATTRIBUTE(NAME) \
FLEXT_ADDATTR_VAR(#NAME,get_##NAME, set_##NAME);
-#define CHAOS_SYS_INIT(NAME, VALUE) \
+
+#define CHAOS_INIT(NAME, VALUE) \
set_##NAME(VALUE);
+#define CHAOS_SYS_INIT(NAME, VALUE, INDEX) \
+set_##NAME(VALUE); \
+t_atom atom_##NAME; \
+flext::SetSymbol(atom_##NAME, flext::MakeSymbol(#NAME)); \
+System.Append(atom_##NAME); \
+attr_ind[flext::MakeSymbol(#NAME)] = INDEX;
+
+#define CHAOS_PAR_INIT(NAME, VALUE) \
+set_##NAME(VALUE); \
+t_atom atom_##NAME; \
+flext::SetSymbol(atom_##NAME, flext::MakeSymbol(#NAME)); \
+Parameter.Append(atom_##NAME);
+
+
#define CHAOS_PARAMETER(NAME) m_##NAME
@@ -142,6 +157,7 @@ class CLASSNAME##_dsp: \
}; \
FLEXT_LIB_DSP_V(#CLASSNAME"~", CLASSNAME##_dsp);
+
#define CHAOS_DSP_CLASS_NAME(CLASSNAME,CLASSNAME_UC, NAME) \
class CLASSNAME##_dsp: \
public chaos_dsp<CLASSNAME> \
@@ -161,6 +177,7 @@ class CLASSNAME##_msg: \
}; \
FLEXT_LIB_V(#CLASSNAME, CLASSNAME##_msg);
+
#define CHAOS_MSG_CLASS_NAME(CLASSNAME,CLASSNAME_UC, NAME) \
class CLASSNAME##_msg: \
public chaos_msg<CLASSNAME> \
@@ -170,9 +187,31 @@ class CLASSNAME##_msg: \
}; \
FLEXT_LIB_V(#NAME, CLASSNAME##_msg);
+#define CHAOS_SEARCH_CLASS(CLASSNAME,CLASSNAME_UC) \
+class CLASSNAME##_search: \
+ public chaos_search<CLASSNAME> \
+{ \
+ CHAOS_SEARCH_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \
+ CLASSNAME_UC##_CALLBACKS; \
+}; \
+FLEXT_LIB_V(#CLASSNAME"_search", CLASSNAME##_search);
+
+
+#define CHAOS_SEARCH_CLASS_NAME(CLASSNAME,CLASSNAME_UC, NAME) \
+class CLASSNAME##_msg: \
+ public chaos_search<CLASSNAME> \
+{ \
+ CHAOS_SEARCH_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \
+ CLASSNAME_UC##_CALLBACKS; \
+}; \
+FLEXT_LIB_V(#NAME, CLASSNAME##_msg);
+
+
+
#define CHAOS_ADD(NAME) \
FLEXT_DSP_SETUP(NAME##_dsp); \
-FLEXT_SETUP(NAME##_msg);
+FLEXT_SETUP(NAME##_msg); \
+FLEXT_SETUP(NAME##_search);
#define __chaos_defs_hpp
#endif /* __chaos_defs_hpp */
diff --git a/chaos/src/chaos_dsp.hpp b/chaos/src/chaos_dsp.hpp
index 879eb49..bb3c5fa 100644
--- a/chaos/src/chaos_dsp.hpp
+++ b/chaos/src/chaos_dsp.hpp
@@ -104,7 +104,7 @@ public:
m_slopes[j] = 0;
}
- if( i == 2)
+ if(i == 2 && imethod != 2)
{
for (int j = 0; j != m_system->get_num_eq(); ++j)
{
@@ -125,9 +125,17 @@ public:
{
if( (f >= 0) && (f <= m_sr*0.5) )
{
+ if (m_freq == -1)
+ set_imethod(m_imethod);
m_freq = f;
m_invfreq = 1.f / f;
}
+ else if (f == -1)
+ {
+ m_freq = -1;
+
+ m_routine = &thisType::m_signal_;
+ }
else
post("frequency out of range");
}
@@ -138,70 +146,70 @@ public:
/* create constructor / destructor */
-#define CHAOS_DSP_INIT(SYSTEM, ATTRIBUTES) \
-FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \
- \
-SYSTEM##_dsp(int argc, t_atom* argv ) \
-{ \
- m_sr = 44100; /* assume default sampling rate */ \
- m_system = new SYSTEM; \
- \
- int size = m_system->get_num_eq(); \
- \
- m_values = new t_float[size]; \
- m_slopes = new t_float[size]; \
- m_nextvalues = new t_float[size]; \
- m_nextmidpts = new t_float[size]; \
- m_curves = new t_float[size]; \
- \
- /* create inlets and zero arrays*/ \
- for (int i = 0; i != size; ++i) \
- { \
- AddOutSignal(); \
- m_values[i] = 0; \
- m_slopes[i] = 0; \
- m_nextvalues[i] = 0; \
- m_nextmidpts[i] = 0; \
- m_curves[i] = 0; \
- } \
- \
- FLEXT_ADDATTR_VAR("frequency", get_freq, set_freq); \
- FLEXT_ADDATTR_VAR("interpolation_method",get_imethod, set_imethod); \
- \
- if (argc > 0) \
- { \
- CHAOS_SYS_INIT(freq, GetAInt(argv[0])); \
- } \
- else \
- { \
- CHAOS_SYS_INIT(freq, 440); \
- } \
- \
- if (argc > 1) \
- { \
- CHAOS_SYS_INIT(imethod, GetAInt(argv[1])); \
- } \
- else \
- { \
- CHAOS_SYS_INIT(imethod, 0); \
- } \
- \
- m_phase = 0; \
- \
- ATTRIBUTES; \
-} \
- \
-~SYSTEM##_dsp() \
-{ \
- delete m_system; \
- delete m_values; \
- delete m_slopes; \
- delete m_nextvalues; \
- delete m_nextmidpts; \
- delete m_curves; \
-} \
- \
-FLEXT_ATTRVAR_F(m_freq); \
+#define CHAOS_DSP_INIT(SYSTEM, ATTRIBUTES) \
+FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \
+ \
+SYSTEM##_dsp(int argc, t_atom* argv ) \
+{ \
+ m_sr = 44100; /* assume default sampling rate */ \
+ m_system = new SYSTEM; \
+ \
+ int size = m_system->get_num_eq(); \
+ \
+ m_values = new t_float[size]; \
+ m_slopes = new t_float[size]; \
+ m_nextvalues = new t_float[size]; \
+ m_nextmidpts = new t_float[size]; \
+ m_curves = new t_float[size]; \
+ \
+ /* create inlets and zero arrays*/ \
+ for (int i = 0; i != size; ++i) \
+ { \
+ AddOutSignal(); \
+ m_values[i] = 0; \
+ m_slopes[i] = 0; \
+ m_nextvalues[i] = 0; \
+ m_nextmidpts[i] = 0; \
+ m_curves[i] = 0; \
+ } \
+ \
+ FLEXT_ADDATTR_VAR("frequency", get_freq, set_freq); \
+ FLEXT_ADDATTR_VAR("interpolation_method",get_imethod, set_imethod); \
+ \
+ if (argc > 0) \
+ { \
+ CHAOS_INIT(freq, GetAInt(argv[0])); \
+ } \
+ else \
+ { \
+ CHAOS_INIT(freq, 440); \
+ } \
+ \
+ if (argc > 1) \
+ { \
+ CHAOS_INIT(imethod, GetAInt(argv[1])); \
+ } \
+ else \
+ { \
+ CHAOS_INIT(imethod, 0); \
+ } \
+ \
+ m_phase = 0; \
+ \
+ ATTRIBUTES; \
+} \
+ \
+~SYSTEM##_dsp() \
+{ \
+ delete m_system; \
+ delete m_values; \
+ delete m_slopes; \
+ delete m_nextvalues; \
+ delete m_nextmidpts; \
+ delete m_curves; \
+} \
+ \
+FLEXT_ATTRVAR_F(m_freq); \
FLEXT_ATTRVAR_I(m_imethod);
diff --git a/chaos/src/chua.hpp b/chaos/src/chua.hpp
index a5db1cb..e54df47 100644
--- a/chaos/src/chua.hpp
+++ b/chaos/src/chua.hpp
@@ -36,15 +36,18 @@ class chua:
public:
chua()
{
- m_num_eq = 3;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x1,1);
- CHAOS_SYS_INIT(x2,1);
- CHAOS_SYS_INIT(x3,1);
- CHAOS_SYS_INIT(a,1.4);
- CHAOS_SYS_INIT(b,0.3);
- CHAOS_SYS_INIT(alpha,0.3);
- CHAOS_SYS_INIT(beta,0.3);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x1,1,0);
+ CHAOS_SYS_INIT(x2,1,1);
+ CHAOS_SYS_INIT(x3,1,2);
+
+ CHAOS_PAR_INIT(a,1.4);
+ CHAOS_PAR_INIT(b,0.3);
+ CHAOS_PAR_INIT(alpha,0.3);
+ CHAOS_PAR_INIT(beta,0.3);
+
+ CHAOS_POSTCONSTRUCTOR;
ode_base_alloc();
}
@@ -52,7 +55,6 @@ public:
~chua()
{
ode_base_free();
- delete m_data;
}
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 91f11d6..b6442a8 100644
--- a/chaos/src/circle_map.hpp
+++ b/chaos/src/circle_map.hpp
@@ -32,16 +32,19 @@ class circle_map:
public:
circle_map()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(omega, 0.1);
- CHAOS_SYS_INIT(r, 3);
- CHAOS_SYS_INIT(x, 0.4);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x, 0.4,0);
+
+ CHAOS_PAR_INIT(omega, 0.1);
+ CHAOS_PAR_INIT(r, 3);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~circle_map()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/coupled_logistic.hpp b/chaos/src/coupled_logistic.hpp
index 85b6928..7cc8602 100644
--- a/chaos/src/coupled_logistic.hpp
+++ b/chaos/src/coupled_logistic.hpp
@@ -21,7 +21,7 @@
#include "map_base.hpp"
// coupled_logistic map: x[n+1] = r * x[n] * (1 - x[n]) + e * (y[n] - x[n])
-// y[n+1] = r * y[n] * (1 - y[n]) + e * (x[t] - y[t])
+// y[n+1] = r * y[n] * (1 - y[n]) + e * (x[n] - y[n])
// 1 <= r <= 4
// taken from Willi-Hans Steeb: Chaos and Fractals
@@ -31,17 +31,19 @@ class coupled_logistic:
public:
coupled_logistic()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(e, 0.06);
- CHAOS_SYS_INIT(r, 3.7);
- CHAOS_SYS_INIT(x, 0.1);
- CHAOS_SYS_INIT(x, 0.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()
{
- delete m_data;
}
virtual void m_step()
@@ -61,8 +63,24 @@ public:
return (f > 0) && (f < 4);
}
- CHAOS_SYSVAR_FUNCS(x, 0);
- CHAOS_SYSVAR_FUNCS(y, 0);
+ CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred_xy);
+ CHAOS_SYSVAR_FUNCS_PRED(y, 0, m_pred_xy);
+
+ bool m_pred_xy(t_float f)
+ {
+ return (f > 0) && (f < 1);
+ }
+
+ virtual void m_verify()
+ {
+ data_t x = m_data[0];
+ data_t y = m_data[1];
+ if (!m_pred_xy(x))
+ m_data[0] = 0.5;
+ if (!m_pred_xy(y))
+ m_data[1] = 0.5;
+ }
+
};
diff --git a/chaos/src/driven_anharmonic.hpp b/chaos/src/driven_anharmonic.hpp
index f4c8da4..16e053b 100644
--- a/chaos/src/driven_anharmonic.hpp
+++ b/chaos/src/driven_anharmonic.hpp
@@ -34,22 +34,22 @@ class driven_anharmonic
public:
driven_anharmonic()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(method,0);
- CHAOS_SYS_INIT(dt,0.01);
+ CHAOS_PAR_INIT(method,0);
+ CHAOS_PAR_INIT(dt,0.01);
- CHAOS_SYS_INIT(u1,0);
- CHAOS_SYS_INIT(u2,1);
+ CHAOS_SYS_INIT(u1,0,0);
+ CHAOS_SYS_INIT(u2,1,1);
- CHAOS_SYS_INIT(a,1);
- CHAOS_SYS_INIT(b,-10);
- CHAOS_SYS_INIT(c,100);
- CHAOS_SYS_INIT(Omega,3.5);
- CHAOS_SYS_INIT(k1,0.01);
- CHAOS_SYS_INIT(k2,1);
+ CHAOS_PAR_INIT(a,1);
+ CHAOS_PAR_INIT(b,-10);
+ CHAOS_PAR_INIT(c,100);
+ CHAOS_PAR_INIT(Omega,3.5);
+ CHAOS_PAR_INIT(k1,0.01);
+ CHAOS_PAR_INIT(k2,1);
+ CHAOS_POSTCONSTRUCTOR;
ode_base_alloc();
m_t = 0;
}
@@ -57,7 +57,7 @@ public:
~driven_anharmonic()
{
ode_base_free();
- delete m_data;
+
}
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 23386b3..65290ee 100644
--- a/chaos/src/driven_van_der_pol.hpp
+++ b/chaos/src/driven_van_der_pol.hpp
@@ -35,27 +35,27 @@ class driven_van_der_pol
public:
driven_van_der_pol()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(method,0);
- CHAOS_SYS_INIT(dt,0.01);
+ CHAOS_PAR_INIT(method,0);
+ CHAOS_PAR_INIT(dt,0.01);
- CHAOS_SYS_INIT(u1,0.8);
- CHAOS_SYS_INIT(u2,0.6);
- CHAOS_SYS_INIT(u3,0.4);
+ CHAOS_SYS_INIT(u1,0.8, 0);
+ CHAOS_SYS_INIT(u2,0.6, 1);
+ CHAOS_SYS_INIT(u3,0.4, 2);
- CHAOS_SYS_INIT(a,5);
- CHAOS_SYS_INIT(Omega,2.466);
- CHAOS_SYS_INIT(k,5);
+ 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();
- delete m_data;
+
}
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 71b8cbd..5110873 100644
--- a/chaos/src/duffing_map.hpp
+++ b/chaos/src/duffing_map.hpp
@@ -31,17 +31,19 @@ class duffing_map:
public:
duffing_map()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x1, 0.5);
- CHAOS_SYS_INIT(x2, 0.5);
- CHAOS_SYS_INIT(a, 0.5);
- CHAOS_SYS_INIT(b, 0.5);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/gauss_map.hpp b/chaos/src/gauss_map.hpp
index 4d62654..1e023d2 100644
--- a/chaos/src/gauss_map.hpp
+++ b/chaos/src/gauss_map.hpp
@@ -33,14 +33,16 @@ class gauss_map:
public:
gauss_map()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x,0.5);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x,0.5, 0);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~gauss_map()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp
index b43034a..73aed66 100644
--- a/chaos/src/henon_map.hpp
+++ b/chaos/src/henon_map.hpp
@@ -31,18 +31,20 @@ class henon:
public:
henon()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(x,0);
- CHAOS_SYS_INIT(y,0);
- CHAOS_SYS_INIT(a,1.4);
- CHAOS_SYS_INIT(b,0.3);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/ikeda_laser_map.hpp b/chaos/src/ikeda_laser_map.hpp
index c62bc15..ece0b9f 100644
--- a/chaos/src/ikeda_laser_map.hpp
+++ b/chaos/src/ikeda_laser_map.hpp
@@ -37,19 +37,22 @@ class ikeda_laser_map:
public:
ikeda_laser_map()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(c1,0.4);
- CHAOS_SYS_INIT(c2,0.9);
- CHAOS_SYS_INIT(c3,9);
- CHAOS_SYS_INIT(roh,0.85);
- CHAOS_SYS_INIT(x,0.5);
- CHAOS_SYS_INIT(y,0.5);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_PAR_INIT(c1,0.4);
+ CHAOS_PAR_INIT(c2,0.9);
+ CHAOS_PAR_INIT(c3,9);
+ CHAOS_PAR_INIT(roh,0.85);
+
+ CHAOS_SYS_INIT(x,0.5,0);
+ CHAOS_SYS_INIT(y,0.5,1);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~ikeda_laser_map()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp
index 1fe1b9a..9884fd1 100644
--- a/chaos/src/latoocarfian.hpp
+++ b/chaos/src/latoocarfian.hpp
@@ -33,20 +33,22 @@ class latoocarfian
public:
latoocarfian()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR
- CHAOS_SYS_INIT(x1,0.5);
- CHAOS_SYS_INIT(x2,0);
- CHAOS_SYS_INIT(a,-0.966918);
- CHAOS_SYS_INIT(b,2.879879);
- CHAOS_SYS_INIT(c,0.765145);
- CHAOS_SYS_INIT(d,0.744728);
+ CHAOS_SYS_INIT(x1,0.5,0);
+ CHAOS_SYS_INIT(x2,0,1);
+
+ CHAOS_PAR_INIT(a,-0.966918);
+ CHAOS_PAR_INIT(b,2.879879);
+ CHAOS_PAR_INIT(c,0.765145);
+ CHAOS_PAR_INIT(d,0.744728);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~latoocarfian()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/latoomutalpha.hpp b/chaos/src/latoomutalpha.hpp
index 015eddf..ca99c12 100644
--- a/chaos/src/latoomutalpha.hpp
+++ b/chaos/src/latoomutalpha.hpp
@@ -32,19 +32,21 @@ class latoomutalpha
public:
latoomutalpha()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(x1,0.5);
- CHAOS_SYS_INIT(x2,0.2);
- CHAOS_SYS_INIT(a,-0.966918);
- CHAOS_SYS_INIT(b,2.879879);
- CHAOS_SYS_INIT(c,0.765145);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
@@ -68,7 +70,7 @@ public:
{
#ifndef DOUBLE_PRECISION
if (PD_BIGORSMALL(m_data[i]))
- m_data[i] = 0.01;
+ m_data[i] = 0.5;
#endif
}
};
diff --git a/chaos/src/latoomutbeta.hpp b/chaos/src/latoomutbeta.hpp
index fac43d6..e27e5a2 100644
--- a/chaos/src/latoomutbeta.hpp
+++ b/chaos/src/latoomutbeta.hpp
@@ -32,18 +32,20 @@ class latoomutbeta
public:
latoomutbeta()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(x1,0.5);
- CHAOS_SYS_INIT(x2,0.5);
- CHAOS_SYS_INIT(a,-0.966918);
- CHAOS_SYS_INIT(b,2.879879);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/latoomutgamma.hpp b/chaos/src/latoomutgamma.hpp
index d83059e..fcdf6a6 100644
--- a/chaos/src/latoomutgamma.hpp
+++ b/chaos/src/latoomutgamma.hpp
@@ -32,18 +32,20 @@ class latoomutgamma
public:
latoomutgamma()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(x1,0.5);
- CHAOS_SYS_INIT(x2,0.5);
- CHAOS_SYS_INIT(a,-0.966918);
- CHAOS_SYS_INIT(b,2.879879);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/logistic_map.hpp b/chaos/src/logistic_map.hpp
index ef2f603..16e824e 100644
--- a/chaos/src/logistic_map.hpp
+++ b/chaos/src/logistic_map.hpp
@@ -30,10 +30,12 @@ class logistic:
public:
logistic()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(alpha, 3.8);
- CHAOS_SYS_INIT(x, 0.5);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_PAR_INIT(alpha, 3.8);
+ CHAOS_SYS_INIT(x, 0.5,0);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~logistic()
diff --git a/chaos/src/lorenz.hpp b/chaos/src/lorenz.hpp
index c876b4a..ee4e516 100644
--- a/chaos/src/lorenz.hpp
+++ b/chaos/src/lorenz.hpp
@@ -31,25 +31,28 @@ class lorenz
public:
lorenz()
{
- m_num_eq = 3;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(method,0);
- CHAOS_SYS_INIT(dt,0.01);
- CHAOS_SYS_INIT(x1,0.8);
- CHAOS_SYS_INIT(x2,0.7);
- CHAOS_SYS_INIT(x3,0.6);
- CHAOS_SYS_INIT(sigma,16);
- CHAOS_SYS_INIT(b,4);
- CHAOS_SYS_INIT(r,40);
+ CHAOS_PAR_INIT(method,0);
+ CHAOS_PAR_INIT(dt,0.01);
+ CHAOS_SYS_INIT(x1,0.8,0);
+ CHAOS_SYS_INIT(x2,0.7,1);
+ CHAOS_SYS_INIT(x3,0.6,2);
+
+ CHAOS_PAR_INIT(sigma,16);
+ CHAOS_PAR_INIT(b,4);
+ CHAOS_PAR_INIT(r,40);
+
+ CHAOS_POSTCONSTRUCTOR;
+
ode_base_alloc();
}
~lorenz()
{
ode_base_free();
- delete m_data;
+
}
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 9219390..3358cf5 100644
--- a/chaos/src/lozi_map.hpp
+++ b/chaos/src/lozi_map.hpp
@@ -31,17 +31,20 @@ class lozi_map:
public:
lozi_map()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x,0);
- CHAOS_SYS_INIT(y,0);
- CHAOS_SYS_INIT(a,1.4);
- CHAOS_SYS_INIT(b,0.3);
+ 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()
{
- delete m_data;
+
}
virtual void m_step()
@@ -57,7 +60,12 @@ public:
m_data[1] = CHAOS_PARAMETER(b) * x;
}
-
+ virtual void m_verify()
+ {
+ if (PD_BIGORSMALL(m_data[0]))
+ m_data[0] = 1;
+ }
+
CHAOS_SYSVAR_FUNCS(x, 0);
CHAOS_SYSVAR_FUNCS(y, 1);
diff --git a/chaos/src/main.cpp b/chaos/src/main.cpp
index c78a7b5..f781f7d 100644
--- a/chaos/src/main.cpp
+++ b/chaos/src/main.cpp
@@ -23,7 +23,7 @@
void chaos_library_setup()
{
- post("chaos~ version "PACKAGE_VERSION", compiled on "__DATE__" \n");
+ post("chaos~ version 0.01, compiled on "__DATE__" \n");
CHAOS_ADD(bernoulli);
diff --git a/chaos/src/roessler.hpp b/chaos/src/roessler.hpp
index 4b36666..3603a58 100644
--- a/chaos/src/roessler.hpp
+++ b/chaos/src/roessler.hpp
@@ -31,25 +31,27 @@ class roessler
public:
roessler()
{
- m_num_eq = 3;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
- CHAOS_SYS_INIT(method,0);
- CHAOS_SYS_INIT(x1,0);
- CHAOS_SYS_INIT(x2,0);
- CHAOS_SYS_INIT(x3,0);
- CHAOS_SYS_INIT(a,4);
- CHAOS_SYS_INIT(b,4);
- CHAOS_SYS_INIT(c,4);
- CHAOS_SYS_INIT(dt,0.01);
+ CHAOS_PAR_INIT(method,0);
+ CHAOS_PAR_INIT(dt,0.01);
+ CHAOS_SYS_INIT(x1,0,0);
+ CHAOS_SYS_INIT(x2,0,1);
+ CHAOS_SYS_INIT(x3,0,2);
+
+ CHAOS_PAR_INIT(a,4);
+ CHAOS_PAR_INIT(b,4);
+ CHAOS_PAR_INIT(c,4);
+
+ CHAOS_POSTCONSTRUCTOR;
ode_base_alloc();
}
~roessler()
{
ode_base_free();
- delete m_data;
+
}
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 8746345..21c7e39 100644
--- a/chaos/src/sine_map.hpp
+++ b/chaos/src/sine_map.hpp
@@ -32,14 +32,16 @@ class sine_map:
public:
sine_map()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x,0);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x,0,0);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~sine_map()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/standard_map.hpp b/chaos/src/standard_map.hpp
index cadcf1e..663280a 100644
--- a/chaos/src/standard_map.hpp
+++ b/chaos/src/standard_map.hpp
@@ -32,17 +32,19 @@ class standard_map:
public:
standard_map()
{
- m_num_eq = 2;
- m_data = new data_t[m_num_eq];
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(I,0.1,0);
+ CHAOS_SYS_INIT(theta,0.2,1);
+
+ CHAOS_PAR_INIT(k, 0.8);
- CHAOS_SYS_INIT(I,0.1);
- CHAOS_SYS_INIT(theta,0.2);
- CHAOS_SYS_INIT(k, 0.8);
+ CHAOS_POSTCONSTRUCTOR;
}
~standard_map()
{
- delete m_data;
+
}
virtual void m_step()
diff --git a/chaos/src/tent_map.hpp b/chaos/src/tent_map.hpp
index 8c00a19..e23fb73 100644
--- a/chaos/src/tent_map.hpp
+++ b/chaos/src/tent_map.hpp
@@ -31,14 +31,16 @@ class tent_map:
public:
tent_map()
{
- m_num_eq = 1;
- m_data = new data_t[m_num_eq];
- CHAOS_SYS_INIT(x, 0.6);
+ CHAOS_PRECONSTRUCTOR;
+
+ CHAOS_SYS_INIT(x, 0.6,0);
+
+ CHAOS_POSTCONSTRUCTOR;
}
~tent_map()
{
- delete m_data;
+
}
virtual void m_step()