fix warning about addWeighted and remove magnitudeSqr().