\section{IQ balance utilities}
\label{group__iqbal}\index{I\+Q balance utilities@{I\+Q balance utilities}}
\subsection*{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}
\subsection*{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}
\subsection*{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 \textbf{ \+\_\+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}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__iqbal_ga2f0587c233b021d72a98a11312ff5e9f}} 
const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} \textbf{ 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}


\subsection{Detailed Description}


\subsection{Function Documentation}
\mbox{\label{group__iqbal_ga169a1a71bbe3ff22192dca26f4d9ef8d}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!\+\_\+iqbal\+\_\+objfn\+\_\+gradient@{\+\_\+iqbal\+\_\+objfn\+\_\+gradient}}
\index{\+\_\+iqbal\+\_\+objfn\+\_\+gradient@{\+\_\+iqbal\+\_\+objfn\+\_\+gradient}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{\+\_\+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{\tt in}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\tt in}  & {\em x} & An array of 2 float for (mag,phase) point to evaluate at \\
\hline
\mbox{\tt in}  & {\em v} & The value of the objective function at point \textquotesingle{}x\textquotesingle{} \\
\hline
\mbox{\tt out}  & {\em grad} & An array of 2 float for the estimated gradient at point \textquotesingle{}x\textquotesingle{} \\
\hline
\end{DoxyParams}


References \+\_\+iqbal\+\_\+objfn\+\_\+value().



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

\mbox{\label{group__iqbal_ga62f9a247afbb52d576a1763ccd47397f}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!\+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient@{\+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient}}
\index{\+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient@{\+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{\+\_\+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{\tt in}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\tt in}  & {\em x} & An array of 2 float for (mag,phase) point to evaluate at \\
\hline
\mbox{\tt 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 \+\_\+iqbal\+\_\+objfn\+\_\+gradient(), and \+\_\+iqbal\+\_\+objfn\+\_\+value().



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

\mbox{\label{group__iqbal_ga743af26acca4fa90afcf1e67dda95dba}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!\+\_\+iqbal\+\_\+objfn\+\_\+value@{\+\_\+iqbal\+\_\+objfn\+\_\+value}}
\index{\+\_\+iqbal\+\_\+objfn\+\_\+value@{\+\_\+iqbal\+\_\+objfn\+\_\+value}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{\+\_\+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{\tt in}  & {\em state} & Current state object of optimization loop \\
\hline
\mbox{\tt 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 \+\_\+osmo\+\_\+iqbal\+\_\+estimate(), \+\_\+iqbal\+\_\+state\+::cache, osmo\+\_\+cxvec\+::data, \+\_\+iqbal\+\_\+state\+::feval, osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+count, osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+size, \+\_\+iqbal\+\_\+state\+::opts, \+\_\+iqbal\+\_\+state\+::org, osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix(), and \+\_\+iqbal\+\_\+state\+::tmp.



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

\mbox{\label{group__iqbal_ga129881cae54362d61dd2b4460f8af248}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!\+\_\+osmo\+\_\+iqbal\+\_\+estimate@{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}}
\index{\+\_\+osmo\+\_\+iqbal\+\_\+estimate@{\+\_\+osmo\+\_\+iqbal\+\_\+estimate}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{\+\_\+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{\tt in}  & {\em data} & Input complex buffer (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+size} & Size of the F\+FT to use internally \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+count} & The number of consecutive F\+FT to use internally \\
\hline
\mbox{\tt out}  & {\em state\+\_\+p} & Cache object for multiple calls (can be N\+U\+LL) \\
\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 N\+U\+LL. 

References \+\_\+iqbal\+\_\+estimate\+\_\+state\+::fft, \+\_\+iqbal\+\_\+estimate\+\_\+state\+::fft\+\_\+plan, and osmo\+\_\+normsqf().



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

\mbox{\label{group__iqbal_ga19298f48b07828c19bc54038d5abe5ad}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate}}
\index{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+estimate}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{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{\tt in}  & {\em sig} & Input complex vector (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+size} & Size of the F\+FT to use internally \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+count} & The number of consecutive F\+FT to use internally \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number $>$= 0.\+0f estimating the IQ balance (the lower, the better) 
\end{DoxyReturn}


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

\mbox{\label{group__iqbal_ga978fbf1c9f01694852c561c95d5ceb9d}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix}}
\index{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+fix}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{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{\tt in}  & {\em in} & Complex input vector \\
\hline
\mbox{\tt in}  & {\em mag} & Magnitude correction (approximated) \\
\hline
\mbox{\tt in}  & {\em phase} & Phase correction (approximated) \\
\hline
\mbox{\tt out}  & {\em out} & Complex output vector (can be N\+U\+LL or equal to \textquotesingle{}in\textquotesingle{}) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output complex vector (or N\+U\+LL if error)
\end{DoxyReturn}
If the \textquotesingle{}out\textquotesingle{} parameter is N\+U\+LL, a new vector will be allocated See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79} for details of the correction applied. 

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



Referenced by \+\_\+iqbal\+\_\+objfn\+\_\+value().

\mbox{\label{group__iqbal_gac74f9d37e2153fdf954e592b36f7c7c0}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize}}
\index{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize@{osmo\+\_\+iqbal\+\_\+cxvec\+\_\+optimize}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{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{\tt in}  & {\em sig} & The input signal to optimize for \\
\hline
\mbox{\tt in,out}  & {\em mag} & Magnitude correction (See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}) \\
\hline
\mbox{\tt in,out}  & {\em phase} & Phase correction (See \doxyref{osmo\+\_\+iqbal\+\_\+fix}{p.}{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}) \\
\hline
\mbox{\tt 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 \+\_\+iqbal\+\_\+objfn\+\_\+gradient(), \+\_\+iqbal\+\_\+objfn\+\_\+val\+\_\+gradient(), \+\_\+iqbal\+\_\+objfn\+\_\+value(), \+\_\+osmo\+\_\+iqbal\+\_\+estimate\+\_\+release(), \+\_\+iqbal\+\_\+state\+::cache, \+\_\+iqbal\+\_\+state\+::feval, osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+count, osmo\+\_\+iqbal\+\_\+opts\+::fft\+\_\+size, osmo\+\_\+cxvec\+::len, osmo\+\_\+iqbal\+\_\+opts\+::max\+\_\+iter, \+\_\+iqbal\+\_\+state\+::opts, \+\_\+iqbal\+\_\+state\+::org, osmo\+\_\+cxvec\+\_\+alloc(), osmo\+\_\+cxvec\+\_\+free(), osmo\+\_\+iqbal\+\_\+default\+\_\+opts, osmo\+\_\+iqbal\+\_\+opts\+::start\+\_\+at\+\_\+prev, and \+\_\+iqbal\+\_\+state\+::tmp.

\mbox{\label{group__iqbal_ga23c6972ae206b4a60dbe49d954fc9caa}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+estimate@{osmo\+\_\+iqbal\+\_\+estimate}}
\index{osmo\+\_\+iqbal\+\_\+estimate@{osmo\+\_\+iqbal\+\_\+estimate}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{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{\tt in}  & {\em data} & Input complex buffer (at least fft\+\_\+size $\ast$ fft\+\_\+count samples) \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+size} & Size of the F\+FT to use internally \\
\hline
\mbox{\tt in}  & {\em fft\+\_\+count} & The number of consecutive F\+FT to use internally \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number $>$= 0.\+0f estimating the IQ balance (the lower, the better) 
\end{DoxyReturn}


References \+\_\+osmo\+\_\+iqbal\+\_\+estimate().



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

\mbox{\label{group__iqbal_gaaca46bab25fe24148c3cb3c4d2158c79}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+fix@{osmo\+\_\+iqbal\+\_\+fix}}
\index{osmo\+\_\+iqbal\+\_\+fix@{osmo\+\_\+iqbal\+\_\+fix}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{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{\tt out}  & {\em out} & Complex output buffer \\
\hline
\mbox{\tt in}  & {\em in} & Complex input buffer \\
\hline
\mbox{\tt in}  & {\em len} & Number of complex samples to process \\
\hline
\mbox{\tt in}  & {\em mag} & Magnitude correction (approximated) \\
\hline
\mbox{\tt 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). 

References osmo\+\_\+cxvec\+::len.



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



\subsection{Variable Documentation}
\mbox{\label{group__iqbal_ga2f0587c233b021d72a98a11312ff5e9f}} 
\index{I\+Q balance utilities@{I\+Q balance utilities}!osmo\+\_\+iqbal\+\_\+default\+\_\+opts@{osmo\+\_\+iqbal\+\_\+default\+\_\+opts}}
\index{osmo\+\_\+iqbal\+\_\+default\+\_\+opts@{osmo\+\_\+iqbal\+\_\+default\+\_\+opts}!I\+Q balance utilities@{I\+Q balance utilities}}
\subsubsection{osmo\+\_\+iqbal\+\_\+default\+\_\+opts}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+iqbal\+\_\+opts} osmo\+\_\+iqbal\+\_\+default\+\_\+opts}

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


Default values for the optimization algorithm. 



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

