A nonsmooth optimization approach to sensor network localization