RLS algorithm