Q)/dXj
        
        dsaQi = sum(daQi.*ii,2) - 2.*aQ(:,d).*ii(:,d);
        dsaQj = sum(daQj.*ii,2);
        dsbQi = sum(dbQi.*ij,2);
        dsbQj = sum(dbQj.*ij,2) - 2.*bQ(:,d).*ij(:,d);
        dm2i = -2*daQi*ij'; % second part of the maha(..) function wrt Xi
        dm2j = -2*ii*(dbQj)'; % second part of the maha(..) function wrt Xj
      end
      
      dm1i = bsxfun(@plus,dsaQi,dsbQi'); % first part of the maha(..) function wrt Xi
      dm1j = bsxfun(@plus,dsaQj,dsbQj'); % first part of the maha(.