1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
awesome-attractor/kernels/Logistic.cpp
2010-08-07 12:55:27 +02:00

44 lines
732 B
C++

//
// $filename
// $projectname
//
// Created by Joshua moerman on $TODAY.
// Copyright 2010 Joshua Moerman. All rights reserved.
//
#include "Logistic.hpp"
#include <algorithm>
Logistic::Logistic():
AttractorKernel(3, 3) {
init();
}
Logistic::Logistic(const unsigned int dimension):
AttractorKernel(dimension, dimension) {
init();
}
void Logistic::init() {
// setting some starting values
for ( unsigned int i = 0; i < dimension; i++ ) {
vectorNew[i] = vectorOld[i] = 0.5;
}
}
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]);
}
}