Browse Source

compilable

master
Joshua 15 years ago
parent
commit
f754b83642
  1. 2
      Attractor.cpp
  2. 4
      kernels/Logistic.cpp
  3. 2
      kernels/Logistic.hpp
  4. 6
      kernels/Polynomial.cpp
  5. 4
      kernels/Polynomial.hpp
  6. 2
      kernels/PolynomialA3D.cpp
  7. 2
      kernels/PolynomialA3D.hpp

2
Attractor.cpp

@ -16,8 +16,6 @@ using namespace std;
Attractor::Attractor(): Attractor::Attractor():
dim(3), par(4), formula(LORENZ), param(NULL), point(NULL), new_point(NULL) { dim(3), par(4), formula(LORENZ), param(NULL), point(NULL), new_point(NULL) {
// Default attractor: 3D Lorenz attrractor // Default attractor: 3D Lorenz attrractor
init_vector();
init_param();
param[0] = 0.001; //dt param[0] = 0.001; //dt
param[1] = 10; //sigma param[1] = 10; //sigma

4
kernels/Logistic.cpp

@ -51,8 +51,8 @@ void Logistic::init() {
void Logistic::iterate() { void Logistic::iterate() {
swap(vectorNew, vectorOld); swap(vectorNew, vectorOld);
for ( unsigned int i = 0; i < dim; i++ ) { for ( unsigned int i = 0; i < dimension; i++ ) {
new_point[i] = param[i]*point[i]*(1.0 - point[i]); vectorNew[i] = myParameters[i]*vectorOld[i]*(1.0 - vectorOld[i]);
} }
} }

2
kernels/Logistic.hpp

@ -1,6 +1,8 @@
#ifndef LOGISTIC_HPP #ifndef LOGISTIC_HPP
#define LOGISTIC_HPP #define LOGISTIC_HPP
#include <cassert>
#include "../AttractorKernel.hpp" #include "../AttractorKernel.hpp"
class Logistic : AttractorKernel { class Logistic : AttractorKernel {

6
kernels/Polynomial.cpp

@ -50,7 +50,7 @@ void Polynomial::init(){
void Polynomial::calculateNumberOfParameters(){ void Polynomial::calculateNumberOfParameters(){
double n_coef = orde + 1; double n_coef = orde + 1;
for (unsigned int i = 2; i <= dim; i++) { for (unsigned int i = 2; i <= dimension; i++) {
n_coef = n_coef*(orde + i)/(i - 1); n_coef = n_coef*(orde + i)/(i - 1);
} }
@ -61,7 +61,7 @@ void Polynomial::iterate() {
swap(vectorNew, vectorOld); swap(vectorNew, vectorOld);
unsigned int m = 0; unsigned int m = 0;
for ( unsigned int i = 0; i < dim; i++ ) { for ( unsigned int i = 0; i < dimension; i++ ) {
#ifdef HARDDEBUG #ifdef HARDDEBUG
cout << "Entering new dimension: " << i << " With m = " << m << endl; cout << "Entering new dimension: " << i << " With m = " << m << endl;
@ -76,7 +76,7 @@ void Polynomial::iterate() {
void Polynomial::recur(unsigned int curr_dimension, unsigned int prev_i, unsigned int n, unsigned int& m, double prev_product) { void Polynomial::recur(unsigned int curr_dimension, unsigned int prev_i, unsigned int n, unsigned int& m, double prev_product) {
double product; double product;
for (unsigned int i = prev_i; i < dim; i++) { for (unsigned int i = prev_i; i < dimension; i++) {
#ifdef HARDDEBUG #ifdef HARDDEBUG
for ( unsigned int j = 0; j < n; j++ ) for ( unsigned int j = 0; j < n; j++ )

4
kernels/Polynomial.hpp

@ -1,6 +1,8 @@
#ifndef POLYNOMIAL_HPP #ifndef POLYNOMIAL_HPP
#define POLYNOMIAL_HPP #define POLYNOMIAL_HPP
#include <cassert>
#include "../AttractorKernel.hpp" #include "../AttractorKernel.hpp"
class Polynomial : public AttractorKernel { class Polynomial : public AttractorKernel {
@ -16,7 +18,7 @@ class Polynomial : public AttractorKernel {
void init(); void init();
void calculateNumberOfParameters(); void calculateNumberOfParameters();
void recur(unsigned int curr_dimension, unsigned int prev_i, unsigned int n, unsigned int& m, double prev_product); void recur(unsigned int curr_dimension, unsigned int prev_i, unsigned int n, unsigned int& m, double prev_product=1.0);
public: public:

2
kernels/PolynomialA3D.cpp

@ -6,6 +6,8 @@
// Copyright 2010 Joshua Moerman. All rights reserved. // Copyright 2010 Joshua Moerman. All rights reserved.
// //
#include "PolynomialA3D.hpp"
const static unsigned int dimension = 3; const static unsigned int dimension = 3;
const static unsigned int numberOfParameters = 3; const static unsigned int numberOfParameters = 3;

2
kernels/PolynomialA3D.hpp

@ -1,6 +1,8 @@
#ifndef POLYNOMIALA3D_HPP #ifndef POLYNOMIALA3D_HPP
#define POLYNOMIALA3D_HPP #define POLYNOMIALA3D_HPP
#include <cassert>
#include "../AttractorKernel.hpp" #include "../AttractorKernel.hpp"
class PolynomialA3D : public AttractorKernel { class PolynomialA3D : public AttractorKernel {