$\newcommand{\GL}{\operatorname{GL}} \newcommand{\R}{{\Bbb R}} \newcommand{\C}{{\Bbb C}} $For a natural number $n$, let $z\in \GL(n,\C)$ be a 1-cocycle of $G=\GL_{n,\R}\,$, that is, an invertible complex matrix such that $$z\cdot\bar z=1$$ where the bar denotes complex conjugation. By a generalization of Hilbert's Theorem 90, we have $H^1(k,\GL_n)=1$ for any field $k$, and in particular, $H^1(\R, \GL_n)=1$. It follows that there exists an element $g\in\GL(n,\C)$ such that \begin{equation}\label{e:1} g^{-1}\cdot \bar g =z,\quad\text{that is,}\quad \bar g =g\cdot z.\tag{$*$} \end{equation}
For example, let $n=2$, $z=\begin{pmatrix} 0&1\\1&0\end{pmatrix}$. Write $g=\begin{pmatrix} a&b\\c&d\end{pmatrix}$. Then \eqref{e:1} gives $$ \begin{pmatrix} \bar a&\bar b\\ \bar c&\bar d\end{pmatrix}= \begin{pmatrix} b&a\\d&c\end{pmatrix},$$ that is, $b=\bar a$ and $c=\bar d$. Thus $$ g=\begin{pmatrix} a&\bar a\\ \bar d&d\end{pmatrix}.$$ We choose $a=1$, $d=i$, and we obtain \begin{equation}\label{e:2} g= \begin{pmatrix} 1& 1\\ -i&i\end{pmatrix}.\tag{$**$} \end{equation}
Question. I need an algorithm that, for given $n$ and a 1-cocycle $z\in \GL(n,\C)$, will give $g\in\GL(n,\C)$ satisfying \eqref{e:1}. Moreover, I want the algorithm to give a nice element $g$. For example, for $z=\begin{pmatrix} 0&1\\1&0\end{pmatrix}$, I want to get something like \eqref{e:2}.
Remark. We (my coauthor and I) already have an algorithm and a computer program for this problem. However, for $z$ as above, our program gives \begin{equation}\label{e:3} \tag{$*{*}*$} \begin{pmatrix} \frac12+i&\tfrac12-i\\ \tfrac12-i&\tfrac12+i\end{pmatrix}, \end{equation} which I like less than \eqref{e:2}.