An Efficient and Universal Static and Dynamic Convex Optimization for Array Synthesis