Convex and structured nonconvex optimization for modern machine learning: Complexity and algorithms