int main(int argc, char *argv[]) { int nPixel1D = 512; int option; option = getopt(argc, argv, "n:"); switch(option) { case 'n': nPixel1D = atoi(optarg); default: break; } /* * Windows won't let us declare local (i.e. stack) variables this * large (Linux will -- so there!), so we need to declare them * static (i.e. global) for portability. */ double *z; ALLOC_ARRAY(z, double, nPixel1D*nPixel1D); //static double z[nPixel1D][nPixel1D]; sampleFunction(hemisphere, z, nPixel1D); // try "ripple" or your own function's name printSquarePgm(z, nPixel1D); return 0; }
int main() { std::cout << "Sample" << std::endl; std::cout << "sample 2" << std::endl; std::cout << "Code" << std::endl; std::cout << "Test" << std::endl; std::cout << "Test2" << std::endl; sampleFunction(); return 0; }
//Gets some test data vector<std::tuple<float*, int*> > getTestData () { vector<std::tuple<float*,int*> > trainingDataSet; for (int x = -50; x != 50; ++x) { for (int y = -50; y != 50; ++y) { float* featureVector = new float[2]; featureVector[0] = ((float) x)/30.0; //normalize the data featureVector[1] = ((float) y)/30.0; //normalize the data int* targets = new int [1]; targets[0] = sampleFunction(x,y);; trainingDataSet.push_back(std::make_tuple(featureVector, targets)); } } std::random_shuffle(trainingDataSet.begin(), trainingDataSet.end()); return trainingDataSet; }