My old project for strange attractors
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

72 lines
1.5 KiB

//
// aatester.cpp
// AwesomeAttract0r
//
// Created by Joshua Moerman on 3/25/12.
// Copyright (c) 2012 Vadovas. All rights reserved.
//
#include <iostream>
#include <vector>
#include "Logger.hpp"
#include "analyse.hpp"
#define LOG(s, p) \
logger.start(s); \
p \
logger.stop()
int verbose = 0;
Logger logger(std::cout, LOG_VERBOSE);
inline double test(const int dimension, const double doubling, const double percentage){
LOG("making vector",
srand(time(0));
std::vector<double *> buffer(1000000);
);
LOG("making random data",
for(auto & p : buffer){
p = new double[dimension];
for(unsigned int i = 2;i < dimension; ++i){
p[i] = rand() / (double) RAND_MAX - 0.5;
}
p[0] = p[1]*p[1];
p[1] = std::sin(5.0*p[2]);
});
LOG("calculate fractal dimension",
double f = fractal_dimension(buffer.begin(), buffer.end(), dimension, doubling, percentage);
);
LOG("freeing data",
for(auto & p : buffer){
delete[] p;
p = 0;
});
return f;
}
int main(){
double percentages[] = {0.00015, 0.00010, 0.00006, 0.00004, 0.000015};
std::cout << "... |";
for(auto p : percentages) std::cout << "\t" << p;
std::cout << std::endl << "----------------------------------------------" << std::endl;
for (double doubling = 2.0; doubling <= 3.0; doubling += 0.1){
std::cout << doubling << " |";
for (auto p : percentages){
double sse = 0;
for (int i = 3; i <= 6; ++i) {
for(int j = 0; j < 20; ++j) {
double e = (i-2) - test(i, doubling, p);
sse += e*e;
}
}
std::cout << "\t" << sse;
}
std::cout << std::endl;
}
}