Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
If your function is convex a local optimum is a global optimum. There are global solvers for non convex functions ( e.g. By partitioning the space and using local solvers) but they are very computationally intensive and may not be able to guarantee optimality. A least square problem is convex though, unless you have some weird constraints.