How can I create an Array
of Convex.MaxAtom
s (or for that matter, other Convex
types) with the Convex
package? I'm not sure if an Array
is the right structure, but what I want to do is initialize something my_array
of length n
so that I can update each element in a loop like
using Convex
v = Variable(n)
w = Variable(n)
my_array = ...initialized array?...
for i = 1:n
my_array[i] = max(v[i],w[i])
end
I've tried doing
my_array = Convex.MaxAtom[]
for i = 1:n
push!(x, max(v[i], w[i]))
end
but I want to avoid reallocating memory and do it upfront. I feel that I must be missing an important part of Julia in not understanding what types to use to construct this.