 #define __int32 int
 
 // Total side of pattern
-int SIDE = 256;
+const int SIDE = 256;
 // Side of non-zero rect in real/autocorrelation space
 // (definition dependent on the problem we are solving)
-int SHORT_SIDE = 25;
-int elem_count = 2 * (SHORT_SIDE * SHORT_SIDE / 2 + SHORT_SIDE % 2);
+const int SHORT_SIDE = 25;
+const int elem_count = SIDE * SIDE;
 
 #include <cufft.h>
 #include <thrust/device_vector.h>

fflush(stdout);
for (int x = 0; x < SIDE * SIDE; x++)
{
	fscanf(in, "%d", &data[x]);
}
}


	int skips = 0;
	column_vector guess;
	guess.set_size(elem_count, 1);

	column_vector lower;
	column_vector upper;
	lower.set_size(elem_count, 1);
	upper.set_size(elem_count, 1);
	//	guess(elem_count) = 1;
	for (int y = 0; y < SIDE; y++)
	{
		for (int x = 0; x < SIDE; x++)
		{
			float val = /*randval(1e-10, 15)*/ truePattern[y * SIDE + x];
			//cufftComplex old = data[index];
			if (val <= 1e-9) val = 1e-2;
			guess(y * SIDE + x) = val;
			lower(y * SIDE + x) = 1e-9;
			upper(y * SIDE + x) = 1e6;
		}
	}

	//lower(SIDE * (SIDE / 2) + SIDE / 2) = 1e5;
end:;

/*        printf("Maximum: %lf\n", find_min_bobyqa(eval, guess, 2 * SHORT_SIDE * SHORT_SIDE + 10, uniform_matrix<double>(elem_count + 1,1,-25000), uniform_matrix<double>(elem_count + 1,1, 25000),
