parameters: (self, qpts, num_neighbors=1, **kwargs)
docstring: For each point in querypts, (which may be a single point), it
          returns the num_neighbors nearest points in the index built by
          calling build_index.
docstring_summary: For each point in querypts, (which may be a single point), it
          returns the num_neighbors nearest points in the index built by
          calling build_index.
docstring_tokens: For each point in querypts ( which may be a single point ) it returns the num_neighbors nearest points in the index built by calling build_index .
function: def nn_index(self, qpts, num_neighbors=1, **kwargs):
          """
          For each point in querypts, (which may be a single point), it
          returns the num_neighbors nearest points in the index built by
          calling build_index.
          """
  
          if self.__curindex is None:
              raise FLANNException(
                  'build_index(...) method not called first or current index deleted.')
  
          if qpts.dtype.type not in allowed_types:
              raise FLANNException('Cannot handle type: %s' % qpts.dtype)
  
          if self.__curindex_type != qpts.dtype.type:
              raise FLANNException('Index and query must have the same type')
  
          qpts = ensure_2d_array(qpts, default_flags)
  
          npts, dim = self.__curindex_data.shape
  
          if qpts.size == dim:
              qpts.reshape(1, dim)
  
          nqpts = qpts.shape[0]
  
          assert qpts.shape[1] == dim, 'data and query must have the same dims'
          assert npts >= num_neighbors, 'more neighbors than there are points'
  
          result = np.empty((nqpts, num_neighbors), dtype=index_type)
          if self.__curindex_type == np.float64:
              dists = np.empty((nqpts, num_neighbors), dtype=np.float64)
          else:
              dists = np.empty((nqpts, num_neighbors), dtype=np.float32)
  
          self.__flann_parameters.update(kwargs)
  
          flann.find_nearest_neighbors_index[
              self.__curindex_type](
              self.__curindex, qpts, nqpts, result, dists, num_neighbors,
              pointer(self.__flann_parameters))
  
          if num_neighbors == 1:
              return (result.reshape(nqpts), dists.reshape(nqpts))
          else:
              return (result, dists)
function_tokens: def nn_index ( self , qpts , num_neighbors = 1 , * * kwargs ) : if self . __curindex is None : raise FLANNException ( 'build_index(...) method not called first or current index deleted.' ) if qpts . dtype . type not in allowed_types : raise FLANNException ( 'Cannot handle type: %s' % qpts . dtype ) if self . __curindex_type != qpts . dtype . type : raise FLANNException ( 'Index and query must have the same type' ) qpts = ensure_2d_array ( qpts , default_flags ) npts , dim = self . __curindex_data . shape if qpts . size == dim : qpts . reshape ( 1 , dim ) nqpts = qpts . shape [ 0 ] assert qpts . shape [ 1 ] == dim , 'data and query must have the same dims' assert npts >= num_neighbors , 'more neighbors than there are points' result = np . empty ( ( nqpts , num_neighbors ) , dtype = index_type ) if self . __curindex_type == np . float64 : dists = np . empty ( ( nqpts , num_neighbors ) , dtype = np . float64 ) else : dists = np . empty ( ( nqpts , num_neighbors ) , dtype = np . float32 ) self . __flann_parameters . update ( kwargs ) flann . find_nearest_neighbors_index [ self . __curindex_type ] ( self . __curindex , qpts , nqpts , result , dists , num_neighbors , pointer ( self . __flann_parameters ) ) if num_neighbors == 1 : return ( result . reshape ( nqpts ) , dists . reshape ( nqpts ) ) else : return ( result , dists )