亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? kd_build.c

?? NIST Handwriting OCR Testbed
?? C
字號(hào):
/*# proc: build_tree - create a tree and insert a specified number of floating# proc:              point vectors of specified class and dimensionality# proc:              into a tree, and return it.# proc: tree_split - recursivly distribute the points in a tree into subtrees# proc:              and attach them as children to the tree# proc: tree_findsplitvalues - indentify a component to control the division# proc:              of a tree, and call an assignment subroutine# proc: tree_entiles - assign suitable ranges for the coefficient on# proc:              which the tree's points are subdivided# proc: tree_onevariance - compute the variance of a specified component of a# proc:              tree's point vectors.# proc: addtotree - add one point to a tree# proc:# proc: init_tree - initialize the elements of a tree# proc:# proc: tree_countleaves - count the leaves contained by a tree# proc:# proc: tree_whichinterval - count the leaves contained by a tree# proc:# proc: tree_order - reorder floating vectors pointed to by a tree into# proc:		     a contiguous memory block, to avoid cache misses.# proc: tree_free - release memory allocated and hel by a tree# proc:# proc: istreechildless - macro (used to be a function) that indicates whether# proc:          tree is a node (which has children) or a leaf (which does not).# proc:          a tree has children or points but not both.*/#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>#include <values.h>#include <kdtree.h>static int nchild = 3;static minpointspernode = 14;TREE *build_tree(points, class, npoints, ni)float *points; int *class, npoints, ni;{int i;TREE *tree;POINT *pts;   if ((tree = (TREE *)malloc(sizeof(TREE))) == NULL)      syserr("build_tree", "malloc", "space for a TREE");   if ((pts = (POINT *)malloc(npoints * sizeof(POINT))) == NULL)      syserr("build_tree", "malloc", "space for points TREE");   init_tree(tree, (float *)points, npoints, ni);   for ( i = 0 ; i < npoints ; i++, points += ni )      pts[i].data = points,		/* just an address somewhere	*/      pts[i].class = class[i];		/* integer class of the point	*/   for ( i = 0 ; i < npoints ; i++ )      addtotree(tree, &pts[i]);   free(pts);   tree_split(tree, minpointspernode, nchild);   tree_order(tree);   return tree;}void tree_split(tree, minpointspernode, nchild)TREE *tree; int minpointspernode, nchild;{int i, oldc, allinsameinterval, c, d;   if (tree->npoints <= minpointspernode)      return;   tree->nchild = nchild;   if ((tree->children = (TREE **)malloc(nchild * sizeof(TREE *))) == NULL)      syserr("tree_split", "malloc", "space for child pointers");   for ( c = 0 ; c < nchild ; c++ )   {      if ((tree->children[c] = (TREE *)malloc(sizeof(TREE))) == NULL)         syserr("tree_split", "malloc", "space for a child");      init_tree(tree->children[c],         tree->pointsdata, minpointspernode, tree->datadimension);   }   tree_findsplitvalues(tree);   /* find which child this point should be passed down to, ie. look	*/   /* for the interval in which the value lies				*/   for ( i = 0, d = tree->splitindex ; i < tree->npoints ; i++ )   {      c = tree_whichinterval(tree, tree->points[i].data[d]);      allinsameinterval = ( i == 0 || (allinsameinterval && oldc == c) );      oldc = c;   }   if (allinsameinterval)   {      for ( c = 0 ; c < nchild ; c++ )         free(tree->children[c]);      free(tree->children);      tree->children = NULL;      tree->nchild = 0;   }   else   {      for ( i = 0, d = tree->splitindex ; i < tree->npoints ; i++ )      {         c = tree_whichinterval(tree, tree->points[i].data[d]);         addtotree(tree->children[c], &tree->points[i]);      }      for ( c = 0 ; c < nchild ; c++ )         tree_split(tree->children[c], minpointspernode, nchild);      tree->allocpoints = 0; /* indicate that there is no allocated space, do not	*/      free(tree->points);	  /* set npoints=0 since that is the number of points	*/      tree->points = NULL;	  /* contained here PLUS in the children		*/   }}void tree_findsplitvalues(tree)TREE *tree;{int d;float vari, maxvari = 0.0;   for ( d = 0 ; d < tree->datadimension ; d++ )      if (maxvari < (vari = tree_onevariance(tree, d)))      {         maxvari = vari;         tree->splitindex = d;      }   tree_entiles(tree, tree->splitindex);}float tree_onevariance(tree, d)TREE *tree; int d;{int i;float vari = 0.0, mean = 0.0;float *point;   for ( i = 0 ; i < tree->npoints; i++ )   {      point = tree->points[i].data;      mean += point[d];      vari += point[d] * point[d];   }   mean /= (float)tree->npoints;   vari /= (float)tree->npoints;   vari -= mean * mean;   return vari;}int comv(a, b)float *a, *b;{float x = *a, y = *b;   return (x < y) ? -1 : ((x > y) ? 1 : 0);}void tree_entiles(tree, d)TREE *tree; int d;{int i, bin;float *vals;   bin = tree->npoints / tree->nchild;   malloc_flt(&vals, tree->npoints, "tree_entiles");   for ( i = 0 ; i < tree->npoints ; i++ )      vals[i] = tree->points[i].data[d];   qsort((void *)vals, (size_t)tree->npoints, sizeof(float), comv);   tree->children[0]->vmin = -MAXFLOAT;   for ( i = 1 ; i < tree->nchild ; i++ )      tree->children[i]->vmin = tree->children[i-1]->vmax = vals[i*bin];   tree->children[i-1]->vmax = MAXFLOAT;   free(vals);}void addtotree(tree, point)TREE *tree; POINT *point;{   if (tree->npoints >= tree->allocpoints)   {      tree->allocpoints += 30;      tree->points = (tree->points == NULL) ?          (POINT *)malloc(tree->allocpoints * sizeof(POINT)) :          (POINT *)realloc(tree->points, tree->allocpoints * sizeof(POINT));      if (tree->points == NULL)         syserr("addtotree", "realloc", "space for 30 more POINTs");   }   tree->points[tree->npoints] = *point;   tree->npoints++;}void init_tree(tree, points, npoints, nidim)TREE *tree; int npoints, nidim; float *points;{    tree->datadimension = nidim;    tree->splitindex = -1;    tree->vmin = MAXFLOAT; tree->vmax = -MAXFLOAT; /* sic! wrong way round */    tree->pointsdata = points;    tree->points = NULL;    tree->npoints = 0;    tree->allocpoints = 0;    tree->nchild = 0;    tree->children = NULL;}int tree_countleaves(tree)TREE *tree;{int i, count = 0;   if (istreechildless(tree))      return 1;   for ( i = 0 ; i < tree->nchild ; i++ )      count += tree_countleaves(tree->children[i]);   return count;}/* actually get under the hood and copy the pointed to floating vectors *//* (not just the pointers to them) to the local leaf, this allows 	*//* contiguous access by the machine, keeping things in the cache and	*//* avoiding paging, which is useful for CPU's to get speed. icky but...	*/void tree_order(tree)TREE *tree;{int i;   if (istreechildless(tree))   {      if (tree->npoints > 0)      {         float *dat, *dst;         POINT *pts;         if ((pts = (POINT *)malloc(tree->npoints * sizeof(POINT))) == NULL)            syserr("tree_order", "malloc", "space for POINTs");         malloc_flt(&dat, tree->datadimension * tree->npoints, "tree_order");         for ( i = 0, dst = dat ; i < tree->npoints ; i++, dst += tree->datadimension )         {            pts[i].class = tree->points[i].class;            memcpy(dst, tree->points[i].data, tree->datadimension * sizeof(float));            pts[i].data  = dst;         }         free(tree->points);         tree->pointsdata = dat;         tree->points = pts;         tree->allocpoints = tree->npoints;      }   }   else      for ( i = 0 ; i < tree->nchild ; i++ )         tree_order(tree->children[i]);}/* find which interval the number value lies in, the index found	*//* indicates the child tree which should contain such a point 		*/int tree_whichinterval(t, val)TREE *t; float val;{int i;   for ( i = 0 ; i < t->nchild ; i++ )      if ( val >= t->children[i]->vmin && val <= t->children[i]->vmax )         return i;   fatalerr("tree_whichinterval", "value", "not in any interval");}void treefree(tree)TREE *tree;{int i;   if (istreechildless(tree))   {      if (tree->pointsdata != NULL) free(tree->pointsdata);      if (tree->points != NULL) free(tree->points);   }   else   {      for ( i = 0 ; i < tree->nchild ; i++ )         treefree(tree->children[i]);      free(tree->children);   }   free(tree);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情一区三区| 精品捆绑美女sm三区| 中文字幕一区av| 国产伦理精品不卡| 欧美不卡激情三级在线观看| 亚洲成人福利片| 色综合久久88色综合天天免费| 国产精品三级av在线播放| 国产综合色在线| 色综合久久88色综合天天6| 亚洲日穴在线视频| 99国产精品久| 亚洲欧美欧美一区二区三区| av成人老司机| 亚洲视频香蕉人妖| 欧美在线你懂的| 亚洲一区二区在线免费看| 欧美写真视频网站| www.亚洲在线| 婷婷国产v国产偷v亚洲高清| 三级成人在线视频| 欧美亚洲愉拍一区二区| 亚洲欧洲一区二区在线播放| 9人人澡人人爽人人精品| 国产精品系列在线| 91色综合久久久久婷婷| 亚洲人精品午夜| 色综合天天综合给合国产| 一区二区三区欧美久久| 色一情一乱一乱一91av| 亚洲欧洲在线观看av| 色哟哟一区二区| 亚洲一区二区高清| 日韩欧美国产精品| 久久se精品一区二区| 8x福利精品第一导航| 久久国内精品自在自线400部| 精品噜噜噜噜久久久久久久久试看 | 日韩三级视频在线观看| 免费成人美女在线观看.| 5858s免费视频成人| 奇米四色…亚洲| 精品国产一区二区三区四区四 | 国产精品久久久久久久久晋中 | 亚洲一级片在线观看| 欧美专区日韩专区| 性欧美疯狂xxxxbbbb| 欧美日韩视频在线观看一区二区三区 | 国产欧美日本一区视频| 91麻豆.com| 亚洲国产成人高清精品| 精品久久久久久综合日本欧美| 国产丶欧美丶日本不卡视频| 国产精品无遮挡| 欧美日韩黄视频| 精品系列免费在线观看| 久久一留热品黄| voyeur盗摄精品| 亚洲视频在线观看三级| 欧美日韩国产首页| 日日夜夜精品视频免费| 精品国产乱码91久久久久久网站| 国产99一区视频免费| 悠悠色在线精品| 26uuu国产一区二区三区| 91在线云播放| 亚洲一区二三区| 国产日产欧美一区二区三区| 91麻豆自制传媒国产之光| 日韩黄色片在线观看| 成人一区二区视频| 欧美美女一区二区| 国产精品麻豆网站| 国内精品视频一区二区三区八戒| 国产乱人伦偷精品视频免下载| 国产高清一区日本| 国产精品系列在线播放| 亚洲人成亚洲人成在线观看图片| 在线观看亚洲a| 国产suv精品一区二区6| 亚洲大尺度视频在线观看| 久久这里只有精品6| 91免费视频网址| 美女免费视频一区二区| 亚洲人成电影网站色mp4| 欧美不卡一区二区三区| 色一区在线观看| 国产精品18久久久| 丝袜美腿亚洲色图| 亚洲人成伊人成综合网小说| 精品国产成人在线影院 | 国产一区二区三区在线观看免费视频 | 久久精品一二三| 欧美亚洲国产怡红院影院| 不卡av在线免费观看| 久久综合国产精品| 中文字幕日韩精品一区| 丝袜美腿高跟呻吟高潮一区| 欧美日韩高清一区二区不卡| 日韩三级中文字幕| 亚洲天天做日日做天天谢日日欢 | 欧美一级黄色片| 福利一区二区在线| 久久99精品国产麻豆婷婷| 中文字幕欧美一| 久久品道一品道久久精品| 欧美一区二区视频观看视频| av午夜精品一区二区三区| 国产精品一线二线三线| 午夜精品久久久久久久久久久| 亚洲国产精品v| 久久久久国产精品人| 91精品久久久久久久99蜜桃| 99久久精品费精品国产一区二区| 国产一区二区三区在线观看精品| 肉丝袜脚交视频一区二区| 午夜精品久久久久久久99樱桃| 国产精品护士白丝一区av| 日韩欧美电影一区| 制服丝袜一区二区三区| 欧美在线你懂的| 一本色道亚洲精品aⅴ| 国产成人免费在线观看不卡| 精品写真视频在线观看| 国内成人精品2018免费看| 日韩中文字幕一区二区三区| 亚洲444eee在线观看| 夜夜揉揉日日人人青青一国产精品 | 色网站国产精品| av动漫一区二区| 大美女一区二区三区| 国产精品99久久久久久似苏梦涵| 男男成人高潮片免费网站| 丝瓜av网站精品一区二区| 亚洲第一精品在线| 亚洲综合免费观看高清完整版| 成人动漫中文字幕| 欧美激情中文字幕| 波多野结衣视频一区| 国产日本欧美一区二区| 国产成人免费在线| 国产精品欧美久久久久无广告| 91小视频免费看| 国产91丝袜在线18| 99re成人在线| 欧美日韩视频专区在线播放| 欧美一区二区福利视频| 韩国午夜理伦三级不卡影院| 亚洲日本一区二区三区| 色香蕉成人二区免费| 日本中文在线一区| 国产精品初高中害羞小美女文| 国产精品久久久久天堂| 精品久久久三级丝袜| 欧美一区二区三区日韩视频| 国产在线不卡一区| 亚洲免费av在线| 欧美一二三区在线| 久久电影国产免费久久电影| 这里只有精品视频在线观看| 免费成人在线视频观看| 亚洲精品高清视频在线观看| 欧美一卡二卡三卡| 国产高清亚洲一区| 视频一区免费在线观看| 久久久久久亚洲综合| 91偷拍与自偷拍精品| 亚洲chinese男男1069| 中文字幕五月欧美| 精品处破学生在线二十三| 色综合久久久久综合| 狠狠色丁香久久婷婷综| 污片在线观看一区二区| 亚洲精品你懂的| 884aa四虎影成人精品一区| 成人网页在线观看| 麻豆精品一区二区三区| 国产精品美女久久久久久久久 | 岛国精品在线播放| 成人免费在线播放视频| wwwwww.欧美系列| 欧美久久一二区| 色欧美日韩亚洲| 成人免费高清在线观看| 极品尤物av久久免费看| 亚洲va欧美va天堂v国产综合| 日韩视频123| 99久久久精品免费观看国产蜜| 精品亚洲成a人| 天天亚洲美女在线视频| 亚洲蜜臀av乱码久久精品| 亚洲国产成人在线| 日韩视频免费观看高清完整版| 欧美美女喷水视频| 欧美精品久久99久久在免费线 | 99久久国产免费看| 亚洲伦理在线精品| 亚洲午夜在线电影| 精品一区二区免费视频| bt欧美亚洲午夜电影天堂|