test for least square optimization