title: Rolling maximum with numpy
body: <p>This computes the "rolling max" of <code>A</code> (similar to rolling average) over a sliding window of length <code>K</code>:</p>
  
  <pre><code>import numpy as np
  A = np.random.rand(100000)
  K = 10
  rollingmax = np.array([max(A[j:j+K]) for j in range(len(A)-K)])
  </code></pre>
  
  <p>but I think it is far from optimal in terms of performance.</p>
  
  <p>I know that the <code>pandas</code> library has <a href="https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.rolling_max.html" rel="noreferrer"><code>rolling_max</code></a>, but in my project, I don't want to use this new dependance. </p>
  
  <p><strong>Question: is there a simple way to compute the rolling maximum with numpy only?</strong></p>