I am a PhD student and I have to address the optimization of a real scalar function of complex variables $f(z_1,z_2,\ldots,z_n)$. The function is real valued in my case because each complex $z_i$ comes with its complex conjugate, *i.e.* there is $z_j$, $j \neq i$ such that $z_i = \bar{z_j}$. I know that an usual way to address such a problem is to perform the optimization with respect to the real and complex parts of the variables, but working in complex allows me to keep a convenient structure for the function and its gradient. Yet the issue is that in my algorithm, numerical errors appear and tend to perturbate the fact that the optimization variables must come in conjugate pairs. Hence I would like to know if there is a convenient way to express this constraint without knowing *a priori* which points must be complex conjugate ? For the time being, I keep an index list of the complex conjugate pairs and each time I compute the function, I check if they are still complex conjugate, if not, i adjust them the best I can. Yet it is not a generic approach and it is not very satisfactory. In particular, it becomes really tedious when the variables cross the real line.