|
|
|
//
|
|
|
|
// $filename
|
|
|
|
// $projectname
|
|
|
|
//
|
|
|
|
// Created by Joshua moerman on $TODAY.
|
|
|
|
// Copyright 2010 Joshua Moerman. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Logistic.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark ctors
|
|
|
|
|
|
|
|
Logistic::Logistic():
|
|
|
|
AttractorKernel(3, 3) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
Logistic::Logistic(const unsigned int dimension):
|
|
|
|
AttractorKernel(dimension, dimension) {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logistic::init() {
|
|
|
|
// setting some starting values
|
|
|
|
std::fill_n(vectorOld, dimension, 0.5);
|
|
|
|
std::fill_n(vectorNew, dimension, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark attractor
|
|
|
|
|
|
|
|
void Logistic::operator()() {
|
|
|
|
std::swap(vectorNew, vectorOld);
|
|
|
|
|
|
|
|
for(unsigned int i = 0; i < dimension; i++) {
|
|
|
|
vectorNew[i] = parameters[i]*vectorOld[i]*(1.0 - vectorOld[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|