\doxysection{Complex vectors math and signal processing} \label{group__cxvec__math}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsection*{Files} \begin{DoxyCompactItemize} \item file \textbf{ cxvec\+\_\+math.\+h} \begin{DoxyCompactList}\small\item\em Osmocom Complex vectors math header. \end{DoxyCompactList}\item file \textbf{ cxvec\+\_\+math.\+c} \begin{DoxyCompactList}\small\item\em Osmocom Complex vectors math implementation. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection*{Enumerations} \begin{DoxyCompactItemize} \item enum \textbf{ osmo\+\_\+cxvec\+\_\+conv\+\_\+type} \{ \textbf{ CONV\+\_\+\+FULL\+\_\+\+SPAN} , \textbf{ CONV\+\_\+\+OVERLAP\+\_\+\+ONLY} , \textbf{ CONV\+\_\+\+NO\+\_\+\+DELAY} \} \begin{DoxyCompactList}\small\item\em Various possible types of convolution span. \end{DoxyCompactList}\item enum \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+alg} \{ \textbf{ PEAK\+\_\+\+WEIGH\+\_\+\+WIN} , \textbf{ PEAK\+\_\+\+WEIGH\+\_\+\+WIN\+\_\+\+CENTER} , \textbf{ PEAK\+\_\+\+EARLY\+\_\+\+LATE} \} \begin{DoxyCompactList}\small\item\em Various possible peak finding algorithms. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item static float \textbf{ osmo\+\_\+sinc} (float x) \begin{DoxyCompactList}\small\item\em Unnormalized sinc function. \end{DoxyCompactList}\item static float \textbf{ osmo\+\_\+normsqf} (float complex c) \begin{DoxyCompactList}\small\item\em Squared norm of a given complex. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+scale} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$in, float complex scale, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Scale a complex vector (multiply by a constant) \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+rotate} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$in, float rps, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Rotate a complex vector (frequency shift) \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+delay} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$in, float delay, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Fractionally delay a vector while maintaining its length. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+convolve} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$f, const struct \textbf{ osmo\+\_\+cxvec} $\ast$g, enum \textbf{ osmo\+\_\+cxvec\+\_\+conv\+\_\+type} type, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Convolve two complex vectors. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+correlate} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$f, const struct \textbf{ osmo\+\_\+cxvec} $\ast$g, int g\+\_\+corr\+\_\+step, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em Cross-\/correlate two complex vectors. \end{DoxyCompactList}\item float complex \textbf{ osmo\+\_\+cxvec\+\_\+interpolate\+\_\+point} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$cv, float pos) \begin{DoxyCompactList}\small\item\em Interpolate any fractional position in a vector using sinc filtering. \end{DoxyCompactList}\item int \textbf{ osmo\+\_\+cxvec\+\_\+peaks\+\_\+scan} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$cv, int $\ast$peaks\+\_\+idx, int N) \begin{DoxyCompactList}\small\item\em Find the index of the N highest energy ( $|x|^2$) peaks. \end{DoxyCompactList}\item float \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+energy\+\_\+find} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$cv, int win\+\_\+size, enum \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+alg} alg, float complex $\ast$peak\+\_\+val\+\_\+p) \begin{DoxyCompactList}\small\item\em Find the maximum energy ( $|x|^2$) peak in a sequence. \end{DoxyCompactList}\item struct \textbf{ osmo\+\_\+cxvec} $\ast$ \textbf{ osmo\+\_\+cxvec\+\_\+sig\+\_\+normalize} (const struct \textbf{ osmo\+\_\+cxvec} $\ast$sig, int decim, float freq\+\_\+shift, struct \textbf{ osmo\+\_\+cxvec} $\ast$out) \begin{DoxyCompactList}\small\item\em \textquotesingle{}Normalize\textquotesingle{} an IQ signal and apply decimation/frequency shift \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} \doxysubsection{Enumeration Type Documentation} \mbox{\label{group__cxvec__math_ga2e183a0f24afa2e16199d1514629bf08}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_conv\_type@{osmo\_cxvec\_conv\_type}} \index{osmo\_cxvec\_conv\_type@{osmo\_cxvec\_conv\_type}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_conv\_type} {\footnotesize\ttfamily enum \textbf{ osmo\+\_\+cxvec\+\_\+conv\+\_\+type}} Various possible types of convolution span. \begin{DoxyEnumFields}{Enumerator} \raisebox{\heightof{T}}[0pt][0pt]{\index{CONV\_FULL\_SPAN@{CONV\_FULL\_SPAN}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!CONV\_FULL\_SPAN@{CONV\_FULL\_SPAN}}}\mbox{\label{group__cxvec__math_gga2e183a0f24afa2e16199d1514629bf08ae758172bda42f9b44aa9015c0e142717}} CONV\+\_\+\+FULL\+\_\+\+SPAN&Full span (every possible overlap of f onto g) \\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{CONV\_OVERLAP\_ONLY@{CONV\_OVERLAP\_ONLY}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!CONV\_OVERLAP\_ONLY@{CONV\_OVERLAP\_ONLY}}}\mbox{\label{group__cxvec__math_gga2e183a0f24afa2e16199d1514629bf08a47fb2e6e9d274d4512601828023ac1d2}} CONV\+\_\+\+OVERLAP\+\_\+\+ONLY&Every possible full overlap of f onto g. \\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{CONV\_NO\_DELAY@{CONV\_NO\_DELAY}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!CONV\_NO\_DELAY@{CONV\_NO\_DELAY}}}\mbox{\label{group__cxvec__math_gga2e183a0f24afa2e16199d1514629bf08a03ece74c3bcd50aeb9fb42329b9a59a5}} CONV\+\_\+\+NO\+\_\+\+DELAY&Center f sequence on every g sample. \\ \hline \end{DoxyEnumFields} \mbox{\label{group__cxvec__math_ga7942b58b341e440c0e8796d395460b78}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_peak\_alg@{osmo\_cxvec\_peak\_alg}} \index{osmo\_cxvec\_peak\_alg@{osmo\_cxvec\_peak\_alg}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_peak\_alg} {\footnotesize\ttfamily enum \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+alg}} Various possible peak finding algorithms. \begin{DoxyEnumFields}{Enumerator} \raisebox{\heightof{T}}[0pt][0pt]{\index{PEAK\_WEIGH\_WIN@{PEAK\_WEIGH\_WIN}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!PEAK\_WEIGH\_WIN@{PEAK\_WEIGH\_WIN}}}\mbox{\label{group__cxvec__math_gga7942b58b341e440c0e8796d395460b78abb4b91d1bfa5bd51ff0e48633d9b9891}} PEAK\+\_\+\+WEIGH\+\_\+\+WIN&Weigthed position for the max pwr window. \\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{PEAK\_WEIGH\_WIN\_CENTER@{PEAK\_WEIGH\_WIN\_CENTER}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!PEAK\_WEIGH\_WIN\_CENTER@{PEAK\_WEIGH\_WIN\_CENTER}}}\mbox{\label{group__cxvec__math_gga7942b58b341e440c0e8796d395460b78ab0fb6b29112253cc5d51fb119b5d812a}} PEAK\+\_\+\+WEIGH\+\_\+\+WIN\+\_\+\+CENTER&Weighted position of the peak centered window. \\ \hline \raisebox{\heightof{T}}[0pt][0pt]{\index{PEAK\_EARLY\_LATE@{PEAK\_EARLY\_LATE}!Complex vectors math and signal processing@{Complex vectors math and signal processing}}\index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!PEAK\_EARLY\_LATE@{PEAK\_EARLY\_LATE}}}\mbox{\label{group__cxvec__math_gga7942b58b341e440c0e8796d395460b78aa8df843abc147bca5860fee1ddff1378}} PEAK\+\_\+\+EARLY\+\_\+\+LATE&Early-\/\+Late balancing around peak. \\ \hline \end{DoxyEnumFields} \doxysubsection{Function Documentation} \mbox{\label{group__cxvec__math_ga2ebadb16e25768896013420a98ec666f}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_convolve@{osmo\_cxvec\_convolve}} \index{osmo\_cxvec\_convolve@{osmo\_cxvec\_convolve}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_convolve()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+convolve (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{f, }\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{g, }\item[{enum \textbf{ osmo\+\_\+cxvec\+\_\+conv\+\_\+type}}]{type, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} Convolve two complex vectors. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em f} & First input complex vector \\ \hline \mbox{\texttt{ in}} & {\em g} & Second input complex vector \\ \hline \mbox{\texttt{ in}} & {\em type} & The convolution span type \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} The convolution of discrete sequences is defined as \+: $(f * g)[n] = \sum_{m=-\infty}^{\infty} f[m] \; g[n-m]$ Altough the mathematical operation is commutative, the constraint of implementation limit this method. Depending on the type of span chosen, it might not be and it\textquotesingle{}s always recommended that \textquotesingle{}g\textquotesingle{} be the longer sequence. It should not be much of a limitation when this methos is used for filtering or pulseshaping \+: use \textquotesingle{}f\textquotesingle{} as the filter and \textquotesingle{}g\textquotesingle{} as the signal. The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector. If it\textquotesingle{}s not NULL, it must be long enough to contain the result (length depends on the exact convolution type) References \textbf{ CONV\+\_\+\+FULL\+\_\+\+SPAN}, \textbf{ CONV\+\_\+\+NO\+\_\+\+DELAY}, \textbf{ CONV\+\_\+\+OVERLAP\+\_\+\+ONLY}, \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, and \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}. Referenced by \textbf{ osmo\+\_\+cxvec\+\_\+delay()}. \mbox{\label{group__cxvec__math_ga99ff6e3baec3253f4e431b156f042a0f}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_correlate@{osmo\_cxvec\_correlate}} \index{osmo\_cxvec\_correlate@{osmo\_cxvec\_correlate}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_correlate()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+correlate (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{f, }\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{g, }\item[{int}]{g\+\_\+corr\+\_\+step, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} Cross-\/correlate two complex vectors. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em f} & First input complex vector \\ \hline \mbox{\texttt{ in}} & {\em g} & Second input complex vector \\ \hline \mbox{\texttt{ in}} & {\em g\+\_\+corr\+\_\+step} & Allow for oversampling of \textquotesingle{}g\textquotesingle{} compared to \textquotesingle{}f\textquotesingle{} \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} The cross-\/correlation of discrete sequences is defined as \+: $(f \star g)[n] = \sum_{m=-\infty}^{\infty} f^*[m] \; g[n+m]$ In this implementation, the output vector will be for every n value between 0 and (g-\/$>$len -\/ f-\/$>$len + 1). This assumes that g is the longer sequence and we \textquotesingle{}fit\textquotesingle{} f at every positition inside it. With the parameter g\+\_\+corr\+\_\+step, it\textquotesingle{}s also possible to have a g sequence that is oversampled with regard to f. (if g\+\_\+corr\+\_\+step $>$ 1) The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector. If it\textquotesingle{}s not NULL, it must be long enough to contain the result (i.\+e. g-\/$>$len -\/ f-\/$>$len + 1) References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, and \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}. \mbox{\label{group__cxvec__math_ga9fa20d926f9d313a4751cef1eff740ba}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_delay@{osmo\_cxvec\_delay}} \index{osmo\_cxvec\_delay@{osmo\_cxvec\_delay}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_delay()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+delay (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{in, }\item[{float}]{delay, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} Fractionally delay a vector while maintaining its length. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em in} & Input complex vector \\ \hline \mbox{\texttt{ in}} & {\em delay} & The fractional delay to apply \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} The output always has the same length. Samples pushed out by the delays are lost and new ones filled with zeroes are pushed in. The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector, or can be equal to the \textquotesingle{}in\textquotesingle{} input vector to perform the transform in-\/place. If it\textquotesingle{}s different, it must be long enough to contain the result (i.\+e. in-\/$>$len) References \textbf{ CONV\+\_\+\+NO\+\_\+\+DELAY}, \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}, \textbf{ osmo\+\_\+cxvec\+\_\+convolve()}, \textbf{ osmo\+\_\+cxvec\+\_\+free()}, \textbf{ osmo\+\_\+cxvec\+\_\+init\+\_\+from\+\_\+data()}, and \textbf{ osmo\+\_\+sinc()}. \mbox{\label{group__cxvec__math_gacb1c646e03a09b51b617467501639763}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_interpolate\_point@{osmo\_cxvec\_interpolate\_point}} \index{osmo\_cxvec\_interpolate\_point@{osmo\_cxvec\_interpolate\_point}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_interpolate\_point()} {\footnotesize\ttfamily float complex osmo\+\_\+cxvec\+\_\+interpolate\+\_\+point (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{cv, }\item[{float}]{pos }\end{DoxyParamCaption})} Interpolate any fractional position in a vector using sinc filtering. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em cv} & Input complex vector \\ \hline \mbox{\texttt{ in}} & {\em pos} & Position to interpolate\\ \hline \end{DoxyParams} pos must be $>$= 0 and $<$ cv-\/$>$len References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, and \textbf{ osmo\+\_\+sinc()}. Referenced by \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+energy\+\_\+find()}. \mbox{\label{group__cxvec__math_ga495219ee953336e15cd68c9b22d3850c}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_peak\_energy\_find@{osmo\_cxvec\_peak\_energy\_find}} \index{osmo\_cxvec\_peak\_energy\_find@{osmo\_cxvec\_peak\_energy\_find}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_peak\_energy\_find()} {\footnotesize\ttfamily float osmo\+\_\+cxvec\+\_\+peak\+\_\+energy\+\_\+find (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{cv, }\item[{int}]{win\+\_\+size, }\item[{enum \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+alg}}]{alg, }\item[{float complex $\ast$}]{peak\+\_\+val\+\_\+p }\end{DoxyParamCaption})} Find the maximum energy ( $|x|^2$) peak in a sequence. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em cv} & Input complex vector \\ \hline \mbox{\texttt{ in}} & {\em win\+\_\+size} & Size of the window (for algorithms using windows) \\ \hline \mbox{\texttt{ in}} & {\em alg} & Peak detection algorithm to use \\ \hline \mbox{\texttt{ out}} & {\em peak\+\_\+val\+\_\+p} & Returns interpolated peak value if non-\/\+NULL \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} Peak position with sub-\/sample accuracy \end{DoxyReturn} References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+\_\+interpolate\+\_\+point()}, \textbf{ osmo\+\_\+normsqf()}, \textbf{ PEAK\+\_\+\+EARLY\+\_\+\+LATE}, \textbf{ PEAK\+\_\+\+WEIGH\+\_\+\+WIN}, and \textbf{ PEAK\+\_\+\+WEIGH\+\_\+\+WIN\+\_\+\+CENTER}. \mbox{\label{group__cxvec__math_gad25b04feb1cd30b24fe7de8f76e56c23}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_peaks\_scan@{osmo\_cxvec\_peaks\_scan}} \index{osmo\_cxvec\_peaks\_scan@{osmo\_cxvec\_peaks\_scan}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_peaks\_scan()} {\footnotesize\ttfamily int osmo\+\_\+cxvec\+\_\+peaks\+\_\+scan (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{cv, }\item[{int $\ast$}]{peaks\+\_\+idx, }\item[{int}]{N }\end{DoxyParamCaption})} Find the index of the N highest energy ( $|x|^2$) peaks. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em cv} & Input complex vector \\ \hline \mbox{\texttt{ out}} & {\em peaks\+\_\+idx} & Return array of the peak indexes \\ \hline \mbox{\texttt{ in}} & {\em Size} & of the peaks\+\_\+idx return array \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} Number of peaks (will be N if there is enough points) \end{DoxyReturn} References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::len}, and \textbf{ osmo\+\_\+normsqf()}. \mbox{\label{group__cxvec__math_ga49125f3c259da9d7eec7fa4d98d609d4}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_rotate@{osmo\_cxvec\_rotate}} \index{osmo\_cxvec\_rotate@{osmo\_cxvec\_rotate}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_rotate()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+rotate (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{in, }\item[{float}]{rps, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} Rotate a complex vector (frequency shift) \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em in} & Input complex vector \\ \hline \mbox{\texttt{ in}} & {\em rps} & Rotation to apply in radian per sample \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} $out(k) = in(k) \cdot e^{j \cdot rps \cdot k}$ The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector, or can be equal to the \textquotesingle{}in\textquotesingle{} input vector to perform the transform in-\/place. If it\textquotesingle{}s different, it must be long enough to contain the result (i.\+e. in-\/$>$len) References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, and \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}. \mbox{\label{group__cxvec__math_ga5ac0adb49726087258381582582ef654}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_scale@{osmo\_cxvec\_scale}} \index{osmo\_cxvec\_scale@{osmo\_cxvec\_scale}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_scale()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+scale (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{in, }\item[{float complex}]{scale, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} Scale a complex vector (multiply by a constant) \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em in} & Input complex vector \\ \hline \mbox{\texttt{ in}} & {\em scale} & Factor to apply to each sample \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} $out(k) = in(k) \cdot scale$ The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector, or can be equal to the \textquotesingle{}in\textquotesingle{} input vector to perform the transform in-\/place. If it\textquotesingle{}s different, it must be long enough to contain the result (i.\+e. in-\/$>$len) References \textbf{ osmo\+\_\+cxvec\+::data}, \textbf{ osmo\+\_\+cxvec\+::flags}, \textbf{ osmo\+\_\+cxvec\+::len}, \textbf{ osmo\+\_\+cxvec\+::max\+\_\+len}, and \textbf{ osmo\+\_\+cxvec\+\_\+alloc()}. \mbox{\label{group__cxvec__math_ga4579583a658fc33afd24a1d8508b212f}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_cxvec\_sig\_normalize@{osmo\_cxvec\_sig\_normalize}} \index{osmo\_cxvec\_sig\_normalize@{osmo\_cxvec\_sig\_normalize}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_cxvec\_sig\_normalize()} {\footnotesize\ttfamily struct \textbf{ osmo\+\_\+cxvec} $\ast$ osmo\+\_\+cxvec\+\_\+sig\+\_\+normalize (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{sig, }\item[{int}]{decim, }\item[{float}]{freq\+\_\+shift, }\item[{struct \textbf{ osmo\+\_\+cxvec} $\ast$}]{out }\end{DoxyParamCaption})} \textquotesingle{}Normalize\textquotesingle{} an IQ signal and apply decimation/frequency shift \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em sig} & Input complex signal \\ \hline \mbox{\texttt{ in}} & {\em decim} & Decimation factor \\ \hline \mbox{\texttt{ in}} & {\em freq\+\_\+shift} & Frequency shift in radian per output sample \\ \hline \mbox{\texttt{ out}} & {\em out} & Output complex vector \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The output complex vector (or NULL if error) \end{DoxyReturn} The operation performed are DC removal, amplitude normalization (divided by the standard deviation), decimation, frequency shift. The output vector parameter \textquotesingle{}out\textquotesingle{} can be NULL to allocate a new vector, or can be equal to the \textquotesingle{}in\textquotesingle{} input vector to perform the transform in-\/place. If it\textquotesingle{}s different, it must be long enough to contain the result (i.\+e. (sig-\/$>$len + decim -\/ 1) / decim) 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\+\_\+normsqf()}. \mbox{\label{group__cxvec__math_ga1b169ec31cb01111c0def0c12d65f3a2}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_normsqf@{osmo\_normsqf}} \index{osmo\_normsqf@{osmo\_normsqf}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_normsqf()} {\footnotesize\ttfamily static float osmo\+\_\+normsqf (\begin{DoxyParamCaption}\item[{float complex}]{c }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}} Squared norm of a given complex. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em c} & Complex number for which to compute the squared norm \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} $|c|^2$ \end{DoxyReturn} Referenced by \textbf{ \+\_\+osmo\+\_\+iqbal\+\_\+estimate()}, \textbf{ osmo\+\_\+cxvec\+\_\+peak\+\_\+energy\+\_\+find()}, \textbf{ osmo\+\_\+cxvec\+\_\+peaks\+\_\+scan()}, and \textbf{ osmo\+\_\+cxvec\+\_\+sig\+\_\+normalize()}. \mbox{\label{group__cxvec__math_ga4e7a7183dc4e5ce77d72d2986495f348}} \index{Complex vectors math and signal processing@{Complex vectors math and signal processing}!osmo\_sinc@{osmo\_sinc}} \index{osmo\_sinc@{osmo\_sinc}!Complex vectors math and signal processing@{Complex vectors math and signal processing}} \doxysubsubsection{osmo\_sinc()} {\footnotesize\ttfamily static float osmo\+\_\+sinc (\begin{DoxyParamCaption}\item[{float}]{x }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}} Unnormalized sinc function. \begin{DoxyParams}[1]{Parameters} \mbox{\texttt{ in}} & {\em x} & Value for which to compute the sinc function. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The sinc(x) value \end{DoxyReturn} The function is defined as $\frac{\sin(x)}{x}$ Referenced by \textbf{ osmo\+\_\+cxvec\+\_\+delay()}, and \textbf{ osmo\+\_\+cxvec\+\_\+interpolate\+\_\+point()}.