there is a need for the 3 functions above also for spectral embedding / laplacian eigenmaps so I guess the code should already exist and be factorized.