⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 euclid.c

📁 NIST Handwriting OCR Testbed
💻 C
字号:
/*# proc: squared_euclid_dist - calculate the euclidean distances of many# proc:                       unknown feature vectors to many known ones# proc: one_squared_euclid_dist - calculate the euclidean distances of one# proc:                       unknown feature vectors to many known ones*/#include <stdio.h>/* for U unknown examples produce the squared euclidean distance 	*//* to each of the K known prototype examples 				*//* the floating vector "dists" should be regarded as a row major U*K 	*//* matrix (U rows, K cols) such that the (u,k) entry is the distance 	*//* of the uth unknown to the kth prototype 				*//* enough space must be pointed to by dists to hold U*K floats 		*/squared_euclid_dist(known, nPats_known, found, nPats_found, nInps, dists)float *known, *found, *dists;int   nPats_known, nPats_found, nInps;{float diff, dist, *dptr, *fptr, *mptr, *kptr;int i, j, k;    for (i = 0, dptr=dists, fptr = found ; i < nPats_found ; i++, fptr += nInps)      for (j = 0, kptr = known ; j < nPats_known ; j++ )      {         for (k = 0, mptr = fptr, dist = 0.0 ; k < nInps ; k++)            diff  = *mptr++ - *kptr++,            dist += diff * diff;         *dptr++ = dist;      }}one_squared_euclid_dist(known, nPats_known, found, nInps, dists)float *known, *found, *dists;int   nPats_known, nInps;{    squared_euclid_dist(known, nPats_known, found, 1, nInps, dists);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -