(dmat, indices_col, n_neighbors)
return submat
Return a submatrix given an orginal matrix and the indices to keep.

    Parameters
    ----------
    dmat: array, shape (n_samples, n_samples)
        Original matrix.

    indices_col: array, shape (n_samples, n_neighbors)
        Indices to keep. Each row consists of the indices of the columns.

    n_neighbors: int
        Number of neighbors.

    Returns
    -------
    submat: array, shape (n_samples, n_neighbors)
        The corresponding submatrix.
Return a submatrix given an orginal matrix and the indices to keep.
Return a submatrix given an orginal matrix and the indices to keep .
def submatrix(dmat, indices_col, n_neighbors):
    """Return a submatrix given an orginal matrix and the indices to keep.

    Parameters
    ----------
    dmat: array, shape (n_samples, n_samples)
        Original matrix.

    indices_col: array, shape (n_samples, n_neighbors)
        Indices to keep. Each row consists of the indices of the columns.

    n_neighbors: int
        Number of neighbors.

    Returns
    -------
    submat: array, shape (n_samples, n_neighbors)
        The corresponding submatrix.
    """
    n_samples_transform, n_samples_fit = dmat.shape
    submat = np.zeros((n_samples_transform, n_neighbors), dtype=dmat.dtype)
    for i in numba.prange(n_samples_transform):
        for j in numba.prange(n_neighbors):
            submat[i, j] = dmat[i, indices_col[i, j]]
    return submat
def submatrix ( dmat , indices_col , n_neighbors ) : n_samples_transform , n_samples_fit = dmat . shape submat = np . zeros ( ( n_samples_transform , n_neighbors ) , dtype = dmat . dtype ) for i in numba . prange ( n_samples_transform ) : for j in numba . prange ( n_neighbors ) : submat [ i , j ] = dmat [ i , indices_col [ i , j ] ] return submat