title: How to "vectorize" this operation?
body: <p>I have data of sample size <code>m</code> of <code>n x n</code> matrices in an <code>n</code> by <code>m*n</code> matrix call it <code>P</code>.</p>
  
  <p>I also have a function, call if <code>f</code>, that operates on a fixed vector, call it <code>v</code>, and <code>n x n</code> matrices and returns a real number. </p>
  
  <p>I want to to create a <code>1 x m</code> vector of real numbers, call it <code>d</code>, by operating <code>f</code> on <code>v</code> and each of the <code>n x n</code> matrices in <code>P</code>.</p>
  
  <p>So, say for example, <code>n = 3</code> and <code>m = 6</code> I would want:</p>
  
  <pre><code>d(1) = f(v,P(:,1:3)), d(2) = f(v,P(:,4:6)), . . ., d(6) = f(v,P(:,16:18))
  </code></pre>
  
  <p>How can I do this without making a loop?</p>
  
  <p>Thanks!</p>