    dm2i = -2*daQi*ij'; <span class="comment">% second part of the maha(..) function wrt Xi</span>
        dm2j = -2*ii*(dbQj)'; <span class="comment">% second part of the maha(..) function wrt Xj</span>
      <span class="keyword">end</span>

      dm1i = bsxfun(@plus,dsaQi,dsbQi'); <span class="comment">% first part of the maha(..) function wrt Xi</span>
      dm1j = bsxfun(@plus,dsaQj,dsbQj'); <span class="comment">% first part of the maha(..) function wrt Xj</span>
      dmahai = dm1i-dm2i;
      dmahaj