From cc18251160a974fc133b641d8a2bec56aceceef0 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 21 Jul 2021 10:51:06 +0200 Subject: [PATCH] rogueviz::embeddings:: mark_signposts_subg --- rogueviz/embeddings.cpp | 19 +++++++++++++++++++ rogueviz/kohonen.h | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/rogueviz/embeddings.cpp b/rogueviz/embeddings.cpp index 58039dce..7dce3b94 100644 --- a/rogueviz/embeddings.cpp +++ b/rogueviz/embeddings.cpp @@ -113,6 +113,25 @@ void mark_signposts(bool full, const vector& ac) { signposts.push_back(c); } +/** special signposts */ + +void mark_signposts_subg(int a, int b, const vector& ac) { + etype = eSignpost; + println(hlog, "marking bitrunc signposts"); + signposts.clear(); + int maxd = 0; + if(!bounded) + for(cell *c: ac) maxd = max(celldist(c), maxd); + for(cell *c: ac) { + auto li = gp::get_local_info(c); + auto rel = li.relative * gp::loc(a, b); + auto rel2 = rel * gp::param.conj(); + rel2 = rel2 / (gp::param * gp::param.conj()).first; + if(rel2 * gp::param == rel) + signposts.push_back(c); + } + } + /** rug embedding */ map rug_coordinates; diff --git a/rogueviz/kohonen.h b/rogueviz/kohonen.h index 9135f764..7a653ebe 100644 --- a/rogueviz/kohonen.h +++ b/rogueviz/kohonen.h @@ -70,6 +70,10 @@ bool finished(); vector gen_neuron_cells(); neuron& winner(int id); + +double vdot(const kohvec& a, const kohvec& b); +void vshift(kohvec& a, const kohvec& b, ld i); +double vnorm(kohvec& a, kohvec& b); } namespace embeddings { @@ -81,12 +85,15 @@ using kohonen::alloc; enum embedding_type { eProjection, eNatural, eLandscape, eSignpost, eHypersian }; extern embedding_type etype; void mark_signposts(bool full, const vector& ac); +void mark_signposts_subg(int a, int b, const vector& ac); void generate_rug(int i, bool close); void init_landscape(int dimensions); extern map rug_coordinates; extern void get_coordinates(kohvec& v, cell *c, cell *c0); +extern vector signposts; + } }