A fast and robust magnetic localization technique based on elimination of the orientation variables from the optimization