Do you think it would be possible to add a constraint to this optimization? My ultimate goal would be able to maximize the cost function with the restraint that the imaginary part is 0 (i.e. I'm looking to maximize the function on the real axis). Would you recommend that I look into editing the manifold factory to reflect the unitary matrices that satisfy this property, or would it be better to find a way to change the gradient?
I apologize about the inconsistencies. I am working on a project to plot the boundary of the set {trace(C.U'.A.U)| U unitary}. It's been proven that this set is star-shaped and has its center at Trace(A)*Trace(C)/N where N is the length of the matrices, so we can assume that the sets are centered at the origin (let A=A-trace(A)/N*I). My first goal was to optimize for the greatest real part and then afterwards add on the constraint that the imaginary part is 0, however I neglected to change the matrices to reflect the center being at the origin. So given that trace(A)=0, there should always exist a unitary matrix such that imag(trace(C.U',A.U) )=0. I hope this clarifies the matter and thank you for taking the time to answer my questions.
Thanks,
Jason
This code works great; occasionally it has a rough starting seed, but the optimization seems very consistent overall. This is exactly what I was looking for and thank you so much for taking the time to help.
Thanks,
Jason