title: Constrained quadratic optimization with the quadProg library
body: <p>I have a vector <code>A</code> of length <code>N</code>. Also I have <code>N*N</code> matrix <code>C</code>. I want to maximize following equation :</p>
  
  <pre><code>minimize (- (w_transpose * A) + p * w_transpose * C * w)
  </code></pre>
  
  <p>Where <code>w</code> is a vector of length <code>N</code>, with constraints that each <code>w</code> is non-negative and sum of all <code>w</code> is 1.</p>
  
  <p>I have seen a package called <code>quadProg</code>. There I need to specify :</p>
  
  <p><code>Dmat = C</code>, <code>dvec = A</code>, and <code>bvec = w</code></p>
  
  <p>but not sure how to apply above mentioned constraints there.</p>
  
  <p>I suppose I could provide <code>Amat</code> to be an identity matrix, which will keep all <code>w</code> non-negative. But not sure how to keep <code>w</code> normalized (sum equal to zero). Actually I could normalize them later as well, but still wondering if I can do it here itself.</p>