{"action":"created","issue":{"url":"https://api.github.com/repos/aaalgo/kgraph/issues/11","repository_url":"https://api.github.com/repos/aaalgo/kgraph","labels_url":"https://api.github.com/repos/aaalgo/kgraph/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/aaalgo/kgraph/issues/11/comments","events_url":"https://api.github.com/repos/aaalgo/kgraph/issues/11/events","html_url":"https://github.com/aaalgo/kgraph/issues/11","id":206709671,"number":11,"title":"Usage of Vector oracle","user":{"login":"eclipse0922","id":6214316,"avatar_url":"https://avatars.githubusercontent.com/u/6214316?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse0922","html_url":"https://github.com/eclipse0922","followers_url":"https://api.github.com/users/eclipse0922/followers","following_url":"https://api.github.com/users/eclipse0922/following{/other_user}","gists_url":"https://api.github.com/users/eclipse0922/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse0922/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse0922/subscriptions","organizations_url":"https://api.github.com/users/eclipse0922/orgs","repos_url":"https://api.github.com/users/eclipse0922/repos","events_url":"https://api.github.com/users/eclipse0922/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse0922/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-02-10T05:04:50Z","updated_at":"2017-02-15T08:04:00Z","closed_at":null,"body":"I need some help to use Kgraph and oracle.\r\n\r\nI have Two data set. \r\n A, B\r\n\r\nEach data set has thousands of 30 dimension data.\r\nA[30][N]  B[30][M]    N is not equal to M\r\n\r\n\r\nI want to find the nearest neighbor(k=1) of A[30][i]  in B\r\n\r\nand vice-versa.\r\n\r\n\r\n\r\nSo I made this vector oracle\r\n\r\n`\t\t\r\n```\r\n\t        using typeECSAD = std::array<float, 30>;\r\n               auto fn_l2_euclid = [](typeECSAD const &a, typeECSAD const &b)\r\n \t\t{\r\n \t\t\tfloat sum = 0.0f;\r\n \t\t\tfor (int i = 0; i < 30; i++)\r\n \t\t\t{\r\n \t\t\t\tsum += pow((a[i] - b[i]), 2);\r\n \t\t\t}\r\n \t\t\tsum = sqrt(sum);\r\n \t\t\treturn sum;\r\n \t\t};\r\n```\r\n\t\t\t\r\n\t\tusing kgraph_ECSAD_oracle = kgraph::VectorOracle<std::vector<typeECSAD>, typeECSAD>;\r\n\t\tkgraph_ECSAD_oracle oracle_fI(m_FeaturesSet[fi], fn_l2_euclid);\r\n\t\tkgraph_ECSAD_oracle oracle_fJ(m_FeaturesSet[fj], fn_l2_euclid);\r\n\r\n\t\tkgraph::KGraph  *index_fI = kgraph::KGraph::create();\r\n\t\tkgraph::KGraph  *index_fJ = kgraph::KGraph::create();\r\n\t\tkgraph::KGraph::IndexParams params;\r\n\r\n\t\tindex_fI->build(oracle_fI, params, NULL);\r\n\t\tindex_fJ->build(oracle_fJ, params, NULL);`\r\n\r\n\r\n\r\nI am not sure that I did it in the right way.\r\n\r\nAnyway, it makes the distance between two data during the index building.\r\n\r\nBut, I have a problem.\r\n\r\nIt holds at parallel_try_insert in sudden.\r\nIt's ok couple of times, but suddenly it stops\r\n\r\n\r\nEnvironment: visual studio 2013 update 5, win7 64bit\r\n\r\n   \r\n```\r\n       unsigned parallel_try_insert (unsigned id, float dist) {\r\n                if (dist > radius) return pool.size();\r\n                LockGuard guard(lock);\r\n                unsigned l = UpdateKnnList(&pool[0], L, Neighbor(id, dist, true));\r\n                if (l <= L) { // inserted\r\n                    if (L + 1 < pool.size()) { // if l == L + 1, there's a duplicate\r\n                        ++L;\r\n                    }\r\n                    else {\r\n                        radius = pool[L-1].dist;\r\n                    }\r\n                }\r\n                return l;\r\n            }\r\n\r\n```\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aaalgo/kgraph/issues/comments/279942721","html_url":"https://github.com/aaalgo/kgraph/issues/11#issuecomment-279942721","issue_url":"https://api.github.com/repos/aaalgo/kgraph/issues/11","id":279942721,"user":{"login":"eclipse0922","id":6214316,"avatar_url":"https://avatars.githubusercontent.com/u/6214316?v=3","gravatar_id":"","url":"https://api.github.com/users/eclipse0922","html_url":"https://github.com/eclipse0922","followers_url":"https://api.github.com/users/eclipse0922/followers","following_url":"https://api.github.com/users/eclipse0922/following{/other_user}","gists_url":"https://api.github.com/users/eclipse0922/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse0922/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse0922/subscriptions","organizations_url":"https://api.github.com/users/eclipse0922/orgs","repos_url":"https://api.github.com/users/eclipse0922/repos","events_url":"https://api.github.com/users/eclipse0922/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse0922/received_events","type":"User","site_admin":false},"created_at":"2017-02-15T08:04:00Z","updated_at":"2017-02-15T08:04:00Z","body":"```\r\n              std::vector<std::array<float,33>> m_FeaturesSet_FPFH ;\r\n\t\tusing typeFPFH = std::array<float, 33>;\r\n\t\tauto fn_l2_euclid = [](typeFPFH const &a, typeFPFH const &b)\r\n\t\t{\r\n\t\t\tfloat sum = 0.0f;\r\n\t\t\tfor (int i = 0; i < a.size(); i++)\r\n\t\t\t{\r\n\t\t\t\tsum += pow((a[i] - b[i]), 2);\r\n\t\t\t}\r\n\t\t\tsum = sqrt(sum);\r\n\t\t\treturn sum;\r\n\r\n\t\t};\r\n\t        using kgraph_FPFH_oracle = kgraph::VectorOracle<std::vector<typeFPFH>, typeFPFH>;\r\n\t\tkgraph_FPFH_oracle oracle_fI(m_FeaturesSet_FPFH[fi], fn_l2_euclid);\r\n\r\n\toracle_fI.query(m_FeaturesSet_FPFH[fj][j]).search(1U, 1e30f, &corres_K[0]);\r\n      ~~\r\n        oracle_fJ.query(m_FeaturesSet_FPFH[fi][i]).search(1U, 1e30f, &corres_K[0]);\r\n```\r\n"}}
{"actor":{"display_login":"eclipse0922"}}