Sorry, i should’ve been more explicit.

I is an MxN matrix (45x37). I am pulling that from the mat file. Some experimental data in reality.

U is an Nx1 vector. This is the unknown I am trying to solve for.

Z is a Mx1 vector. That’s the known target. I set it to zeros. But explicitly set z[4]=-2.0 in my example code.

I am of course able to describe the same function in both languages see (lines 11 in Python and 55 in Julia version).

Thanks for sharing the post. I noticed this linked there: https://jump.dev/JuMP.jl/stable/nlp/#User-defined-functions-with-vector-inputs-1

I couldn’t quite grasp the work around. I am new to Julia so perhaps I misunderstand something. Its a relatively simple linear equation:

obj_function(U) = 0.5 * ((U’ * (I’ * I)) * U) + transpose(-1 * (I’ * z)) * U

How could something like this be passed without using vectors/matrices?

For reference. I use IPOPT to minimize this function. The only constrains are that each element of U is within 0-400^2