Optimization for Regression, PCA, and SVM: Optimality and Scalability