Browse Source

fixed a bugje, hardcoded 2 dim (todo: implementing projectors good), ikeda has more parameters

master
Joshua Moerman (joshua-desktop) 14 years ago
parent
commit
b111948939
  1. 1
      Attractor.hpp
  2. 3
      Projector.cpp
  3. 11
      kernels/Ikeda3D.hpp

1
Attractor.hpp

@ -35,6 +35,7 @@ public:
if(kernel->convergent() || kernel->divergent()){
kernel->generate_random_parameters();
LogDebug("Generating new parameters.\n");
i = 0;
}
}
}

3
Projector.cpp

@ -4,7 +4,8 @@
#include "projectors/Normalizer.hpp"
Projector* Projector::createProjector(stfu::node& projector, unsigned int input_dimension) {
Projector* output = new Normalizer(input_dimension);
//Projector* output = new Normalizer(input_dimension);
Projector* output = new Normalizer(2);
return output;
}

11
kernels/Ikeda3D.hpp

@ -16,7 +16,7 @@ private:
public:
Ikeda3D():
AttractorKernel(3, 1) {
AttractorKernel(3, 4) {
init();
}
@ -24,16 +24,19 @@ public:
virtual void generate_random_parameters() {
parameters[0] = rand() / double(RAND_MAX) *2.0 - 0.5;
parameters[1] = rand() / double(RAND_MAX) *2.0 - 0.5; // wikipedia: u
parameters[2] = rand() / double(RAND_MAX) *2.0 - 0.5;
parameters[3] = rand() / double(RAND_MAX) *30.0;
init();
}
virtual void operator()() {
std::swap(vectorNew, vectorOld);
vectorOld[2] = 0.4 - 6.0/(1 + vectorOld[0]*vectorOld[0] + vectorOld[1]*vectorNew[1]);
vectorOld[2] = parameters[2] - parameters[3]/(1 + vectorOld[0]*vectorOld[0] + vectorOld[1]*vectorNew[1]);
vectorNew[0] = 1 + parameters[0] * (vectorOld[0]*cos(vectorOld[2]) - vectorOld[1]*sin(vectorOld[2]));
vectorNew[0] = parameters[0] * (vectorOld[0]*sin(vectorOld[2]) + vectorOld[1]*cos(vectorOld[2]));
vectorNew[0] = parameters[0] + parameters[1] * (vectorOld[0]*cos(vectorOld[2]) - vectorOld[1]*sin(vectorOld[2]));
vectorNew[1] = parameters[1] * (vectorOld[0]*sin(vectorOld[2]) + vectorOld[1]*cos(vectorOld[2]));
}
};