MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / reproducePrint

Function reproducePrint

examples/machine_learning/geneticalgorithm.cpp:106–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void reproducePrint(float& currentMax, array& searchSpace, array& sampleX,
107 array& sampleY, array& sampleZ, const float trueMax,
108 const int nSamples, const int n) {
109 if (currentMax < trueMax * 0.99) {
110 float maximum = max<float>(sampleZ);
111 array whereM = where(sampleZ == maximum);
112 if (maximum < trueMax * 0.99) {
113 printf("Current max at ");
114 } else {
115 printf("\nMax found at ");
116 }
117 printf("(%d,%d): %f (trueMax %f)\n",
118 sampleX(whereM).scalar<unsigned int>(),
119 sampleY(whereM).scalar<unsigned int>(), maximum, trueMax);
120 currentMax = maximum;
121 reproduce(searchSpace, sampleX, sampleY, sampleZ, nSamples, n);
122 }
123}
124
125void geneticSearch(bool console, const int nSamples, const int n) {
126 array searchSpaceXDisplay;

Callers 1

geneticSearchFunction · 0.85

Calls 2

reproduceFunction · 0.85
whereFunction · 0.50

Tested by

no test coverage detected