The Trefftz method for solving eigenvalue problems