Beispiel #1
0
    def test_neighbor_search(self):
        metric = self.metric
        db = TestDB()
        gnat = g.build_gnat(db, metric=self.metric)
        for count in xrange(20):
            p = randomx()
            
            linear_key = linear_neighbor_query(db, metric, p)

            gnat_key = list(gnat.neighbor_query(p))[0]

            self.assertEqual(linear_key, gnat_key)
Beispiel #2
0
 def make_gnat(self, db, metric):
     return g.build_gnat(db, metric=metric)
Beispiel #3
0
    def make_gnat(self, db, metric):
        gnat = g.build_gnat(db, metric=metric)

        serialized = g.gnat_table_rows(gnat)

        return g.load_gnat_from_rows(db, serialized, metric)