Example #1
0
 def __init__(self,size=0,dim=0,vdb=None):
     """
     Initializes class with VectorDB structure
     """
     if vdb:
         self.vdb=vdb
     else:
         self.vdb = la.vectordb_create(size,dim)
Example #2
0
def ndarray_to_vectordb(arr):
    """
    Converts a numpy multidimensional array to a VectorDB structure
    """
    vdb = la.vectordb_create(arr.shape[0], arr.shape[1])
    for i,row in enumerate(arr):
        for j,value in enumerate(row):
            if value != 0:
                vdb.push(int(i), int(j), value)
    return LPLSH(ldb=ldb)