\HeaderA{localMaximum}{Identify local maximum within a slide window.}{localMaximum}
\keyword{methods}{localMaximum}
\begin{Description}\relax
Find local maximum by transform the vector as matrix, then get the the maximum of each column. This operation is performed twice with vecctor shifted half of the winSize.
\end{Description}
\begin{Usage}
\begin{verbatim}
localMaximum(x, winSize = 5)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a vector represents a signal profile
\item[\code{winSize}] the slide window size, 5 by default.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Instead of find the local maximum by a slide window, which slide all possible positions, we find local maximum by transform the vector as matrix, then get the the maximum of each column. This operation is performed twice with vecctor shifted half of the winSize. The main purpose of this is to increase the efficiency of the algorithm.
\end{Details}
\begin{Value}
Return a vector with the same length of the input x. The position of local maximum is set as 1, 0 else where.
\end{Value}
\begin{Author}\relax
Pan Du
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{getLocalMaximumCWT}{getLocalMaximumCWT}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- rnorm(200)
lmax <- localMaximum(x, 5)
maxInd <- which(lmax > 0)
plot(x, type='l')
points(maxInd, x[maxInd], col='red')
\end{ExampleCode}
\end{Examples}

