diff --git a/rogueviz/kohonen.cpp b/rogueviz/kohonen.cpp index 2b42ccd6..88496ac0 100644 --- a/rogueviz/kohonen.cpp +++ b/rogueviz/kohonen.cpp @@ -264,10 +264,7 @@ bool triangulate(kohvec d, neuron& w, map& find, transmatrix& re } if(diff < bdiff) bdiff = diff, candidate = w2, cdir = i; } - if(cdir == -1) { - println(hlog, "not enough directions"); - return false; - } + if(cdir == -1) break; dirs.push_back(cdir); other.push_back(candidate); kv.push_back(candidate->net); @@ -291,6 +288,7 @@ bool triangulate(kohvec d, neuron& w, map& find, transmatrix& re for(int i=0; i& v) { vector res; for(int i=0; i<10; i++) res.push_back(v[i]); return res; }; println(hlog, "dot too small, i=", i,", dirs=", dirs); println(hlog, "a = ", head(a)); @@ -299,6 +297,7 @@ bool triangulate(kohvec d, neuron& w, map& find, transmatrix& re println(hlog, "orig kv: ", head(z->net), " @ ", z->where); for(auto z: kv) println(hlog, "curr kv: ", head(z)); + */ return false; } for(int j=i+1; j> dispersion; + vector> dispersion; }; double dispersion_end_at = 1.6; +bool dispersion_long; + double dispersion_precision = .0001; int dispersion_each = 1; @@ -476,10 +477,10 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) { cr.build(cellwalker(c,dir)); if(!gaussian) { - vector curtemp; - vector newtemp; + vector curtemp; + vector newtemp; vector qty; - vector > pairs; + vector > pairs; int N = isize(net); curtemp.resize(N, 0); @@ -503,8 +504,8 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) { auto &d = cr.dispersion; d.clear(); - - DEBBI(DF_LOG, ("Building dispersion, precision = ", dispersion_precision, " end_at = ", dispersion_end_at, "...\n")); + + // DEBBI(DF_LOG, ("Building dispersion, precision = ", dispersion_precision, " end_at = ", dispersion_end_at, "...\n")); for(iter=0; dispersion_count ? true : vmax > vmin * dispersion_end_at; iter++) { if(iter % dispersion_each == 0) { @@ -527,10 +528,13 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) { for(int i=0; i vmax) vmax = curtemp[i]; + // if(iter % 50 == 0) println(hlog, "iter=", iter, " vmin=", vmin, " vmax=", vmax, " pairs=", isize(pairs)); } - dispersion_count = isize(d); - DEBB(DF_LOG, ("Dispersion count = ", dispersion_count)); + if(!dispersion_count) { + if(!dispersion_long) dispersion_count = isize(d); + DEBB(DF_LOG, ("Dispersion count = ", isize(d), " celldist = ", celldist(c))); + } /* println(hlog, "dlast = ", d.back()); println(hlog, "dlast2 = ", d[d.size()-2]); @@ -542,7 +546,9 @@ void buildcellcrawler(cell *c, cellcrawler& cr, int dir) { map scc; pair get_cellcrawler_id(cell *c) { - if(among(geometry, gZebraQuotient, gMinimal, gArnoldCat, gField435, gField534) || (euclid && quotient && !bounded) || IRREGULAR || (GDIM == 3 && sphere) || (hyperbolic && GDIM == 3 && quotient) + if(!bounded) + return make_pair(neuronId(*getNeuronSlow(c)), 0); + if(among(geometry, gZebraQuotient, gMinimal, gArnoldCat, gField435, gField534) || (euclid && quotient && !bounded) || IRREGULAR || (GDIM == 3 && sphere) || (hyperbolic && GDIM == 3) || (euclid && nonorientable)) { // Zebra Quotient does exhibit some symmetries, // but these are so small anyway that it is safer to just build @@ -893,7 +899,7 @@ void initialize_dispersion() { DEBBI(DF_LOG, ("Initializing dispersion")); - if(gaussian) { + if(gaussian || true) { DEBB(DF_LOG, ("dist = ", fts(mydistance(net[0].where, net[1].where)))); cell *c1 = net[cells/2].where; vector mapdist; @@ -902,19 +908,26 @@ void initialize_dispersion() { maxdist = mapdist[isize(mapdist)*5/6] * distmul; DEBB(DF_LOG, ("maxdist = ", fts(maxdist))); } - + dispersion_count = 0; - + + if(!gaussian) + DEBB(DF_LOG, ("dispersion precision = ", dispersion_precision, " end_at = ", dispersion_end_at, "...\n")); + + DEBB(DF_LOG, ("building crawlers...\n")); + scc.clear(); for(int i=0; i