improve eigenvalue sorting
improve scala style