Commit d535206c authored by Sabrina Templeton's avatar Sabrina Templeton
Browse files

trying to fix random seed

parent af548402
......@@ -315,6 +315,10 @@ PowerDiagram::evaluate_objective( index_t n , const real_t* x , real_t* grad ) {
min_vol,max_vol,regularization_total
);
FILE * pFile;
pFile = fopen ("avro_results.txt", "a");
fprintf(pFile, "%12.3e\n", time_voronoi_ );
return multiplier*energy_;
}
......
Subproject commit 617cb653ec513b4e02d7104b05fb75c26d10e79e
Subproject commit 91a6e129d9274a0b10943044e5aeae08471e00fe
......@@ -19,7 +19,7 @@ UT_TEST_CASE( test_2d )
static coord_t number = 2;
static coord_t dim = number;
index_t nb_points = 1e4;
index_t nb_points = 50;
index_t N = 2;
std::vector<index_t> dims(number,N);
......@@ -92,11 +92,23 @@ UT_TEST_CASE( test_2d )
Points sites(dim);
#if 0 // test exactness
ckf.points().copy( sites );
nb_points = sites.nb();
#elif SPHERE == 0
srand(24);
// std::cout << "here" << std::endl;
// for (index_t k = 0; k < 50; k++){
// std::cout << random_within(0.0,1.0) << std::endl;
// }
for (index_t k = 0; k < nb_points; k++) {
for (coord_t d = 0; d < number; d++)
for (coord_t d = 0; d < number; d++){
point[d] = random_within(0.0,1.0);
//std::cout << point[d] << std::endl;
}
sites.create(point);
}
#else
......@@ -126,7 +138,7 @@ UT_TEST_CASE( test_2d )
diagram.set_sites( sites );
diagram.initialize();
diagram.optimize_points_lloyd(20);
diagram.optimize_points_lloyd(1);
std::vector<real_t> mass( sites.nb() , diagram.volume() / real_t(sites.nb()) );
......
......@@ -126,7 +126,7 @@ UT_TEST_CASE( test1 )
// *************************************************************************
//generate random seeds desired times 3
int num_points = 1e6;
int num_points = 50;
int size = num_points*3;
......@@ -136,23 +136,50 @@ UT_TEST_CASE( test1 )
std::vector<graphics::gl_float> seeds;
srand (time(NULL));
srand(24);
if (MODE == 0){
for (int i = 0; i < size; i ++){
double val = double(rand()) / double(RAND_MAX);
for (int i = 0; i < size; i ++){
if ((i - 2) % 3 == 0){
seeds.push_back(0.0); // make the z coordinate 0
//std::cout << i << std::endl;
std::cout << i << std::endl;
}
else {
double val = double(rand()) / double(RAND_MAX);
//std::cout << i << std::endl;
seeds.push_back(val);
}
//std::cout << seeds[i] << std::endl;
// //std::cout << seeds[i] << std::endl;
// for (index_t k = 0; k < num_points; k++){
// std::cout << random_within(0.0,1.0) << std::endl;
}
// };
// real_t point[3];
// for (index_t k = 0; k < num_points; k++) {
// for (coord_t d = 0; d < 3; d++){
// if (d < 2) {
// point[d] = random_within(0.0,1.0);
// //std::cout << point[d] << std::endl;
// seeds.push_back(point[d]);
// }
// //seeds.push_back(point[d]);
// if (d == 2){
// seeds.push_back(0.0);
// }
// }
// }
};
//std::cout << "Test Print!!!!!!!!!!!!!";
}
else if (MODE == 1){
float dx = 1 / (sqrt(num_points) ); //delta y is the same if we're going for a grid
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment