Demo entry 6734451

mahalanobis

   

Submitted by anonymous on Apr 20, 2018 at 14:19
Language: C. Code size: 372 Bytes.

for(rx=0,pttx=tx; rx<nrx; rx++) {
	for(cx=0, ptsigma=sigma, result[rx]=0; cx<ncx; cx++, pttx++, ptsigma+=ncx) {
		result[rx]+=*pttx* ptsigma[cx]*(*pttx);
	}
	
	for(aux=0, i=0, pttxi=pttx-ncx, ptsigma=sigma; i<ncx; i++, pttxi++, ptsigma+=ncx) {
		for(j=i+1, pttxj=pttxi+1; j<ncx; j++, pttxj++) {
			aux+=*pttxi* ptsigma[j]*(*pttxj);
		}
	}
	result[rx]+= 2*aux;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).