code: def precompute_optimzation_S(laplacian_matrix,n_samples,relaxation_kwds):
      
      relaxation_kwds.setdefault('presave',False)
      relaxation_kwds.setdefault('presave_name','pre_comp_current.npy')
      relaxation_kwds.setdefault('verbose',False)
      if relaxation_kwds['verbose']:
          print ('Pre-computing quantities Y to S conversions')
          print ('Making A and Pairs')
      A, pairs = makeA(laplacian_matrix)
      if relaxation_kwds['verbose']:
          print ('Making Rk and nbhds')
      Rk_tensor, nbk = compute_Rk(laplacian_matrix,A,n_samples)
      # TODO: not quite sure what is ATAinv? why we need this?
      ATAinv = np.linalg.pinv(A.T.dot(A).todense())
      if relaxation_kwds['verbose']:
          print ('Finish calculating pseudo inverse')
      if relaxation_kwds['presave']:
          raise NotImplementedError('Not yet implemented presave')
      return { 'RK': Rk_tensor, 'nbk': nbk,
               'ATAinv': ATAinv, 'pairs': pairs, 'A': A }
docs: compute Rk, A, ATAinv, neighbors and pairs for projected mode