I am looking to use the frobenius norm of a matrix as an objective. Here is the setup:
nkrauss = 4
model = Model(Ipopt.Optimizer)
# Krauss operator variables
nKelems = nkrauss * dims^2
Kelems = [@variable(model, set = ComplexPlane()) for i in 1:nKelems]
Ks = reshape(Kelems, (dims, dims, nkrauss))
constraints = [@constraint(model, K' * K .== I) for K in eachslice(Ks, dims=3)]
approx = sum(Array([K * r * K' for K in eachslice(Ks, dims=3)]))
@NLobjective(model, Min, sum((approx - rprime) .^ 2))
I see the following error:
ERROR: Unrecognized function “.^” used in nonlinear expression.
Where am I going wrong? Is there a better way to implement a Frobenius norm objective?
Thank you!