title: How can I (efficiently) compute a moving average of a vector?
body: <p>I've got a vector and I want to calculate the moving average of it (using a window of width 5).</p>
  
  <p>For instance, if the vector in question is <code>[1,2,3,4,5,6,7,8]</code>, then</p>
  
  <ul>
  <li>the first entry of the resulting vector should be the sum of all entries in <code>[1,2,3,4,5]</code> (i.e. <code>15</code>);</li>
  <li>the second entry of the resulting vector should be the sum of all entries in <code>[2,3,4,5,6]</code> (i.e. <code>20</code>);</li>
  <li>etc.</li>
  </ul>
  
  <p>In the end, the resulting vector should be <code>[15,20,25,30]</code>. How can I do that?</p>