\doxysection{IQ balance utilities}
\label{group__iqbal}\index{IQ balance utilities@{IQ balance utilities}}
\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ iqbal.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom IQ balance utils header. \end{DoxyCompactList}\item 
file \textbf{ iqbal.\+c}
\begin{DoxyCompactList}\small\item\em IQ balance utils implementation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+iqbal\+\_\+opts}
\begin{DoxyCompactList}\small\item\em Processing options for the IQ balance optimization algorithm. \end{DoxyCompactList}\item 
struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state}
\begin{DoxyCompactList}\small\item\em Cache for \doxyref{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}{p.}{group__iqbal_ga129881cae54362d61dd2b4460f8af248} when doing lots of calls. \end{DoxyCompactList}\item 
struct \textbf{ \+\_\+iqbal\+\_\+state}
\begin{DoxyCompactList}\small\item\em Internal state structure for the IQ balance optimization algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ osmo\+\_\+iqbal\+\_\+fix} (float complex $\ast$out, float complex $\ast$in, unsigned int len, float mag, float phase)
\begin{DoxyCompactList}\small\item\em Apply IQ balance correction to a given complex buffer. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$in, float mag, float phase, struct \textbf{ osmo\+\_\+cxvec} $\ast$out)
\begin{DoxyCompactList}\small\item\em Apply IQ balance correction to a given complex vector. \end{DoxyCompactList}\item 
float \textbf{ osmo\+\_\+iqbal\+\_\+estimate} (const float complex $\ast$data, int fft\+\_\+size, int fft\+\_\+count)
\begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex buffer. \end{DoxyCompactList}\item 
float \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$sig, int fft\+\_\+size, int fft\+\_\+count)
\begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex vector. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$sig, float $\ast$mag, float $\ast$phase, const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} $\ast$opts)
\begin{DoxyCompactList}\small\item\em Finds the best IQ balance correction parameters for a given signal. \end{DoxyCompactList}\item 
\mbox{\label{group__iqbal_ga5ece20030938ef8e8f9e1c3f2d91482a}} 
static void {\bfseries \+\_\+osmo\+\_\+iqbal\+\_\+estimate\+\_\+release} (struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} $\ast$state)
\begin{DoxyCompactList}\small\item\em Release a cache object created by \doxyref{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}{p.}{group__iqbal_ga129881cae54362d61dd2b4460f8af248}. \end{DoxyCompactList}\item 
static float \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate} (const float complex $\ast$data, int fft\+\_\+size, int fft\+\_\+count, struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} $\ast$$\ast$state\+\_\+p)
\begin{DoxyCompactList}\small\item\em Objectively estimate IQ balance in a given complex buffer. \end{DoxyCompactList}\item 
static float \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2])
\begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Value. \end{DoxyCompactList}\item 
static void \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+gradient} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2], float v, float grad[2])
\begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Gradient estimation. \end{DoxyCompactList}\item 
static float \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient} (struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$state, float x[2], float grad[2])
\begin{DoxyCompactList}\small\item\em Optimization objective function -\/ Value \& Gradient estimation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__iqbal_ga2f0587c233b021d72a98a11312ff5e9f}} 
const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} {\bfseries osmo\+\_\+iqbal\+\_\+default\+\_\+opts}
\begin{DoxyCompactList}\small\item\em Default values for the optimization algorithm. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} \textbf{ osmo\+\_\+iqbal\+\_\+default\+\_\+opts}
\begin{DoxyCompactList}\small\item\em Default values for the optimization algorithm. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}


\doxysubsection{Function Documentation}
\mbox{\label{group__iqbal_ga169a1a71bbe3ff22192dca26f4d9ef8d}} 
\index{IQ balance utilities@{IQ balance utilities}!\_iqbal\_objfn\_gradient@{\_iqbal\_objfn\_gradient}}
\index{\_iqbal\_objfn\_gradient@{\_iqbal\_objfn\_gradient}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{\_iqbal\_objfn\_gradient()}
{\footnotesize\ttfamily static void \+\_\+iqbal\+\_\+objfn\+\_\+gradient (\begin{DoxyParamCaption}\item[{struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$}]{state,  }\item[{float}]{x[2],  }\item[{float}]{v,  }\item[{float}]{grad[2] }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Optimization objective function -\/ Gradient estimation. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\texttt{ in}}  & {\em x} & An array of 2 float for (mag,phase) point to evaluate at \\
\hline
\mbox{\texttt{ in}}  & {\em v} & The value of the objective function at point \textquotesingle{}x\textquotesingle{} \\
\hline
\mbox{\texttt{ out}}  & {\em grad} & An array of 2 float for the estimated gradient at point \textquotesingle{}x\textquotesingle{} \\
\hline
\end{DoxyParams}


References \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value()}.



Referenced by \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient()}, and \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize()}.

\mbox{\label{group__iqbal_ga62f9a247afbb52d576a1763ccd47397f}} 
\index{IQ balance utilities@{IQ balance utilities}!\_iqbal\_objfn\_val\_gradient@{\_iqbal\_objfn\_val\_gradient}}
\index{\_iqbal\_objfn\_val\_gradient@{\_iqbal\_objfn\_val\_gradient}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{\_iqbal\_objfn\_val\_gradient()}
{\footnotesize\ttfamily static float \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient (\begin{DoxyParamCaption}\item[{struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$}]{state,  }\item[{float}]{x[2],  }\item[{float}]{grad[2] }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Optimization objective function -\/ Value \& Gradient estimation. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\texttt{ in}}  & {\em x} & An array of 2 float for (mag,phase) point to evaluate at \\
\hline
\mbox{\texttt{ out}}  & {\em grad} & An array of 2 float for the estimated gradient at point \textquotesingle{}x\textquotesingle{} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The value of the objective function at point \textquotesingle{}x\textquotesingle{} 
\end{DoxyReturn}


References \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+gradient()}, and \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value()}.



Referenced by \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize()}.

\mbox{\label{group__iqbal_ga743af26acca4fa90afcf1e67dda95dba}} 
\index{IQ balance utilities@{IQ balance utilities}!\_iqbal\_objfn\_value@{\_iqbal\_objfn\_value}}
\index{\_iqbal\_objfn\_value@{\_iqbal\_objfn\_value}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{\_iqbal\_objfn\_value()}
{\footnotesize\ttfamily static float \+\_\+iqbal\+\_\+objfn\+\_\+value (\begin{DoxyParamCaption}\item[{struct \textbf{ \+\_\+iqbal\+\_\+state} $\ast$}]{state,  }\item[{float}]{x[2] }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Optimization objective function -\/ Value. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\texttt{ in}}  & {\em x} & An array of 2 float for (mag,phase) point to evaluate at \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The value of the objective function at point \textquotesingle{}x\textquotesingle{} 
\end{DoxyReturn}


References \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate()}, \textbf{ \+\_\+iqbal\+\_\+state\+::cache}, \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ \+\_\+iqbal\+\_\+state\+::feval}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+count}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+size}, \textbf{ \+\_\+iqbal\+\_\+state\+::opts}, \textbf{ \+\_\+iqbal\+\_\+state\+::org}, \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix()}, and \textbf{ \+\_\+iqbal\+\_\+state\+::tmp}.



Referenced by \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+gradient()}, \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient()}, and \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize()}.

\mbox{\label{group__iqbal_ga129881cae54362d61dd2b4460f8af248}} 
\index{IQ balance utilities@{IQ balance utilities}!\_osmo\_iqbal\_estimate@{\_osmo\_iqbal\_estimate}}
\index{\_osmo\_iqbal\_estimate@{\_osmo\_iqbal\_estimate}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{\_osmo\_iqbal\_estimate()}
{\footnotesize\ttfamily static float \+\_\+osmo\+\_\+iqbal\+\_\+estimate (\begin{DoxyParamCaption}\item[{const float complex $\ast$}]{data,  }\item[{int}]{fft\+\_\+size,  }\item[{int}]{fft\+\_\+count,  }\item[{struct \textbf{ \+\_\+iqbal\+\_\+estimate\+\_\+state} $\ast$$\ast$}]{state\+\_\+p }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Objectively estimate IQ balance in a given complex buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & Input complex buffer (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+size} & Size of the FFT to use internally \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+count} & The number of consecutive FFT to use internally \\
\hline
\mbox{\texttt{ out}}  & {\em state\+\_\+p} & Cache object for multiple calls (can be NULL) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number $>$= 0.\+0f estimating the IQ balance (the lower, the better)
\end{DoxyReturn}
The Cache object should only be used for multiple calls with the same parameters and the same size of input vector. Once you don\textquotesingle{}t plan on using it anymore, you should call \doxyref{\+\_\+osmo\+\_\+iqbal\+\_\+estimate\+\_\+release}{p.}{group__iqbal_ga5ece20030938ef8e8f9e1c3f2d91482a} . The initial pointer value should also be initialized to NULL. 

References \textbf{ osmo\+\_\+normsqf()}.



Referenced by \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value()}, and \textbf{ osmo\+\_\+iqbal\+\_\+estimate()}.

\mbox{\label{group__iqbal_ga19298f48b07828c19bc54038d5abe5ad}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_cxvec\_estimate@{osmo\_iqbal\_cxvec\_estimate}}
\index{osmo\_iqbal\_cxvec\_estimate@{osmo\_iqbal\_cxvec\_estimate}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_cxvec\_estimate()}
{\footnotesize\ttfamily float osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{sig,  }\item[{int}]{fft\+\_\+size,  }\item[{int}]{fft\+\_\+count }\end{DoxyParamCaption})}



Objectively estimate IQ balance in a given complex vector. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em sig} & Input complex vector (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+size} & Size of the FFT to use internally \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+count} & The number of consecutive FFT to use internally \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number $>$= 0.\+0f estimating the IQ balance (the lower, the better) 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::len}, and \textbf{ osmo\+\_\+iqbal\+\_\+estimate()}.

\mbox{\label{group__iqbal_ga978fbf1c9f01694852c561c95d5ceb9d}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_cxvec\_fix@{osmo\_iqbal\_cxvec\_fix}}
\index{osmo\_iqbal\_cxvec\_fix@{osmo\_iqbal\_cxvec\_fix}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_cxvec\_fix()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{in,  }\item[{float}]{mag,  }\item[{float}]{phase,  }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})}



Apply IQ balance correction to a given complex vector. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em in} & Complex input vector \\
\hline
\mbox{\texttt{ in}}  & {\em mag} & Magnitude correction (approximated) \\
\hline
\mbox{\texttt{ in}}  & {\em phase} & Phase correction (approximated) \\
\hline
\mbox{\texttt{ out}}  & {\em out} & Complex output vector (can be NULL or equal to \textquotesingle{}in\textquotesingle{}) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output complex vector (or NULL if error)
\end{DoxyReturn}
If the \textquotesingle{}out\textquotesingle{} parameter is NULL, a new vector will be allocated See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79} for details of the correction applied. 

References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}, and \textbf{ osmo\+\_\+iqbal\+\_\+fix()}.



Referenced by \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value()}.

\mbox{\label{group__iqbal_gac74f9d37e2153fdf954e592b36f7c7c0}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_cxvec\_optimize@{osmo\_iqbal\_cxvec\_optimize}}
\index{osmo\_iqbal\_cxvec\_optimize@{osmo\_iqbal\_cxvec\_optimize}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_cxvec\_optimize()}
{\footnotesize\ttfamily int osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{sig,  }\item[{float $\ast$}]{mag,  }\item[{float $\ast$}]{phase,  }\item[{const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} $\ast$}]{opts }\end{DoxyParamCaption})}



Finds the best IQ balance correction parameters for a given signal. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em sig} & The input signal to optimize for \\
\hline
\mbox{\texttt{ in,out}}  & {\em mag} & Magnitude correction (See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}) \\
\hline
\mbox{\texttt{ in,out}}  & {\em phase} & Phase correction (See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}) \\
\hline
\mbox{\texttt{ in}}  & {\em opts} & Options of the optimization process (See \doxyref{osmo\+\_\+iqbal\+\_\+opts}{p.}{structosmo__iqbal__opts})\\
\hline
\end{DoxyParams}
The mag and phase parameters are pointers to float. If in the options, the \textquotesingle{}start\+\_\+at\+\_\+prev\textquotesingle{} is enabled, the initial values of those will be used and so they should be initialized appropriately. 

References \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+gradient()}, \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient()}, \textbf{ \+\_\+iqbal\+\_\+objfn\+\_\+value()}, \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate\+\_\+release()}, \textbf{ \+\_\+iqbal\+\_\+state\+::cache}, \textbf{ \+\_\+iqbal\+\_\+state\+::feval}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+count}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+size}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::max\+\_\+iter}, \textbf{ \+\_\+iqbal\+\_\+state\+::opts}, \textbf{ \+\_\+iqbal\+\_\+state\+::org}, \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}, \textbf{ osmo\+\_\+cxvec\+\_\+free()}, \textbf{ osmo\+\_\+iqbal\+\_\+default\+\_\+opts}, \textbf{ osmo\+\_\+iqbal\+\_\+opts\+::start\+\_\+at\+\_\+prev}, and \textbf{ \+\_\+iqbal\+\_\+state\+::tmp}.

\mbox{\label{group__iqbal_ga23c6972ae206b4a60dbe49d954fc9caa}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_estimate@{osmo\_iqbal\_estimate}}
\index{osmo\_iqbal\_estimate@{osmo\_iqbal\_estimate}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_estimate()}
{\footnotesize\ttfamily float osmo\+\_\+iqbal\+\_\+estimate (\begin{DoxyParamCaption}\item[{const float complex $\ast$}]{data,  }\item[{int}]{fft\+\_\+size,  }\item[{int}]{fft\+\_\+count }\end{DoxyParamCaption})}



Objectively estimate IQ balance in a given complex buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & Input complex buffer (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+size} & Size of the FFT to use internally \\
\hline
\mbox{\texttt{ in}}  & {\em fft\+\_\+count} & The number of consecutive FFT to use internally \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number $>$= 0.\+0f estimating the IQ balance (the lower, the better) 
\end{DoxyReturn}


References \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate()}.



Referenced by \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate()}.

\mbox{\label{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_fix@{osmo\_iqbal\_fix}}
\index{osmo\_iqbal\_fix@{osmo\_iqbal\_fix}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_fix()}
{\footnotesize\ttfamily void osmo\+\_\+iqbal\+\_\+fix (\begin{DoxyParamCaption}\item[{float complex $\ast$}]{out,  }\item[{float complex $\ast$}]{in,  }\item[{unsigned int}]{len,  }\item[{float}]{mag,  }\item[{float}]{phase }\end{DoxyParamCaption})}



Apply IQ balance correction to a given complex buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em out} & Complex output buffer \\
\hline
\mbox{\texttt{ in}}  & {\em in} & Complex input buffer \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Number of complex samples to process \\
\hline
\mbox{\texttt{ in}}  & {\em mag} & Magnitude correction (approximated) \\
\hline
\mbox{\texttt{ in}}  & {\em phase} & Phase correction (approximated)\\
\hline
\end{DoxyParams}
The input and output buffers can be the same for in-\/place modification.

The applied transform is out[i] = (a $\ast$ (1 + mag)) + (b + phase $\ast$ a) $\ast$ i (with in[i] = a+bi). 

Referenced by \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__iqbal_ga2f0587c233b021d72a98a11312ff5e9f}} 
\index{IQ balance utilities@{IQ balance utilities}!osmo\_iqbal\_default\_opts@{osmo\_iqbal\_default\_opts}}
\index{osmo\_iqbal\_default\_opts@{osmo\_iqbal\_default\_opts}!IQ balance utilities@{IQ balance utilities}}
\doxysubsubsection{osmo\_iqbal\_default\_opts}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} osmo\+\_\+iqbal\+\_\+default\+\_\+opts}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        .fft\_size       = 1024,}
\DoxyCodeLine{        .fft\_count      = 8,}
\DoxyCodeLine{        .max\_iter       = 25,}
\DoxyCodeLine{        .start\_at\_prev  = 1,}
\DoxyCodeLine{\}}

\end{DoxyCode}


Default values for the optimization algorithm. 



Referenced by \textbf{ osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize()}.

