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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kdtree_common.cc

?? 用matlab編寫的k-dtree
?? CC
字號:
// Guy Shechter// June 2004// Variables used for time debugging.TV tv1,tv2; TZ tz;//// Call this function to build the k-d Tree.//Tree *build_kdtree(double *reference, int N, int D, int *index, 		   int L,int offset) {  Tree *treeptr;  if ( (treeptr = (Tree *) malloc(sizeof(Tree))) == NULL )    mexPrintf("Error allocating memory for kD-Tree\n");    treeptr->rootptr = build_kdtree_core(reference, N, D, index, L, offset);  treeptr->dims = D;  return treeptr;}//// This is the core function for building the k-D tree for raw input data.//Node *build_kdtree_core(double *reference, int N, int D, int *index, 			int L,int offset) {  int i,median;  Node *nodeptr;  #ifdef DEBUG_BUILD_TREE  mexPrintf("Entering build_kdtree \n");#endif    if ( (nodeptr = (Node *) malloc(sizeof(Node))) == NULL )    mexPrintf("Error allocating memory for kD-Tree\n");  if ( (nodeptr->pt = (double*) malloc(sizeof(double)*D)) == NULL )    mexPrintf("Error allocating memory for kD-Tree\n");    if (L==1) {    for (i=0; i < D; i++)      nodeptr->pt[i] = EVAL_INDEX(index[0],i,N);    nodeptr->index = (unsigned int) index[0];    #ifdef DEBUG_BUILD_TREE    mexPrintf("Created leaf     node, (dim=%d) (value: ", offset);    for (i=0; i < D; i++)      mexPrintf(" %f",nodeptr->pt[i]);    mexPrintf(" )\n");#endif        nodeptr->orientation = offset;    nodeptr->left=NULL;    nodeptr->right=NULL;    return nodeptr;  }    quicksort(index,0,L-1,reference,offset,N);  median = (int)((L)/2.0);    for (i=0; i < D; i++)    nodeptr->pt[i] = EVAL_INDEX(index[median],i,N);  nodeptr->index = (unsigned int) index[median];  nodeptr->orientation = offset;  nodeptr->left=NULL;  nodeptr->right=NULL;  #ifdef DEBUG_BUILD_TREE  mexPrintf("Created internal node, (dim=%d) (value: ", offset);  for (i=0; i < D; i++)    mexPrintf(" %f",nodeptr->pt[i]);  mexPrintf(" )\n");#endif    nodeptr->left = build_kdtree_core(reference,N,D,index,median,(offset+1)%D);    if (L-median-1)    nodeptr->right = build_kdtree_core(reference,N,D,index+median+1,				       L-median-1,(offset+1)%D);    return nodeptr;}// //   The following two functions are for the quicksort algorithm //int partition(int *a, int p, int r, double *reference, int offset, int D){  int i,j;  double x,tmp;    x= EVAL_INDEX(a[p],offset,D); i=p-1; j=r+1;  while (1) {    for (j--; EVAL_INDEX(a[j],offset,D) > x; j--);    for (i++; EVAL_INDEX(a[i],offset,D) <x; i++);    if (i<j){      INT_SWAP(a[j],a[i]);    }    else return j;  }}void quicksort(int *ra, int p, int r, double *reference, int offset,int D){  int q;    if (p < r) {    q = partition(ra,p,r,reference,offset,D);    quicksort(ra,p,q,reference,offset,D);    quicksort(ra,q+1,r,reference,offset,D);  }}//// Deallocate memory used by the k-D tree//void free_tree(Node *pVertex) {    if (pVertex == NULL)    return;  if (pVertex->left)  free_tree(pVertex->left);  if (pVertex->right) free_tree(pVertex->right);    free(pVertex->pt);  free(pVertex);  return;}//// Compute the norm distance between two points of dimension Dim//double calcdistance(double *pt1, double *pt2, int Dim){  int j;  double d=0;  for (j=0; j < Dim; j++)     d+= (pt1[j]-pt2[j])*(pt1[j]-pt2[j]);  return (sqrt(d));}Node *pointLocation(Node *v, double *pt,int D){    //if (!v) v=root;  if ( ( v->left == NULL) && (v->right == NULL) )     return v;  if (    pt[v->orientation] < v->pt[ v->orientation] )    return ( (v->left) ? pointLocation(v->left,pt,D) : v);  else if (    pt[v->orientation] > v->pt[v->orientation]  )     return ( (v->right) ? pointLocation(v->right,pt,D): v);  else {    //What we have is pt[v->orientation] == v->pt[v->orientation]     Node *vl = ( (v->left)? pointLocation(v->left,pt,D) : v);    Node *vr = ( (v->right)? pointLocation(v->right,pt,D) : v);    if ( calcdistance(vl->pt,pt,D) < calcdistance(vr->pt,pt,D) )      return vl;    else      return vr;  }}Node * rangeQuery(Node *v, double distance, double *pt, int D){  Node *current=NULL, *tmp;  int j;    if ( ( (v->pt[v->orientation] - distance) <=  pt[v->orientation]) &&       ( (v->pt[v->orientation] + distance) >=  pt[v->orientation]) ){    if (calcdistance(pt,v->pt,D) <= distance){      current=(Node*) malloc(sizeof(Node));      current->pt=(double*) malloc(sizeof(double)*D);      current->right=NULL;      for (j=0; j < D; j++) current->pt[j]=v->pt[j];      current->index=v->index;    }  }    if (  (!(v->left)) && (!(v->right)) )     return current;    tmp=current;  while (tmp && tmp->right)     tmp=tmp->right;    if (v->left){    if ( v->pt[v->orientation] >= (pt[v->orientation] - distance ) ){      if (tmp)	tmp->right=rangeQuery(v->left, distance, pt,D);      else	current=rangeQuery(v->left, distance, pt, D);    }  }    tmp=current;  while (tmp &&tmp->right)     tmp=tmp->right;    if (v->right){    if (   v->pt[v->orientation]  <= (pt[v->orientation] + distance ) ){      if (tmp)	tmp->right=rangeQuery(v->right, distance, pt, D);      else	current=   rangeQuery(v->right, distance, pt, D);    }  }      return current;}//// The top-level function for running a query on the k-D tree.//void run_queries( Node *pVertex, double *model, int M, int D, 		  double *closest_pt, double *distance, short ReturnType) {    int i,j;  double min_distance, *pt;  Node *LL, *cur, *leaf, *tmp;    pt= (double*)malloc(sizeof(double)*D);    for (i=0; i < M; i++) {    #ifdef DEBUG_RUN_QUERIES    mexPrintf("Running Query (%d/%d) (value: ",	      i+1, M);    for (j=0; j < D ; j++)      mexPrintf(" %f", model[ M*j+i]);    mexPrintf(" )\n");#endif        for (j=0; j < D; j++)       pt[j]=model[M*j+i];        leaf=pointLocation(pVertex,pt,D);    min_distance=calcdistance(leaf->pt, pt,D )+0.001;    LL=rangeQuery(pVertex,min_distance,pt,D);    if (!LL) {      if (ReturnType == RETURN_INDEX) 	closest_pt[i] = -1;      else{	for (j=0; j< D; j++)	  closest_pt[j*M+i]=-1;      }      mexPrintf("Null LL\n");    }     else {      distance[i]=calcdistance(LL->pt, pt,D);      if (ReturnType == RETURN_INDEX) 	closest_pt[i] = LL->index;      else {	for (j=0; j < D; j++) 	  closest_pt[j*M+i] = LL->pt[j];      }      cur=LL;      while (cur){	if ( calcdistance(cur->pt, pt,D) <= distance[i] ) {	  if (ReturnType == RETURN_INDEX) 	    closest_pt[i] = cur->index;	  else {	    for (j=0; j < D; j++) 	      closest_pt[j*M+i] = cur->pt[j];	  }	  distance[i]=calcdistance(cur->pt, pt,D);	}	tmp=cur;	cur=cur->right;	free(tmp->pt);	free(tmp);      }    }#ifdef DEBUG_RUN_QUERIES    mexPrintf("Distance to closest point is %f\n",distance[i]);#endif  }  free(pt);}// // Outputs the k-D tree while performing a depth first traversal.//void display_tree(Node *nodeptr,int D) {  int i;    mexPrintf("Node: (dim = %d) (idx= %u) (value = ", nodeptr->orientation,	    nodeptr->index);  for (i=0; i <D; i++)    mexPrintf("%f\t",nodeptr->pt[i]);  mexPrintf(")\n");  if (nodeptr->left == NULL)     mexPrintf("Left is (null)\n");  else{    mexPrintf("Going left\n");    display_tree(nodeptr->left,D);  }    if (nodeptr->right == NULL)     mexPrintf("Right is (null)\n");  else{    mexPrintf("Going right\n");    display_tree(nodeptr->right,D);  }}//// The top-level function for running a range search on the k-D tree.//void run_range_search( Node *pVertex, double *model, int M, int D, 		       double distlim, double **pts_in_range, 		       unsigned int *L, unsigned int **indices){    int i,j, count;  double min_distance;  double *pt;  Node *LL, *cur, *leaf, *tmp;  pt= (double*)malloc(sizeof(double)*D);  for (i=0; i < M; i++) {#ifdef DEBUG_RUN_RANGE_SEARCH    mexPrintf("Running Search (%d/%d) (value: ",	      i+1, M);    for (j=0; j < D ; j++)      mexPrintf(" %f", model[ M*j+i]);    mexPrintf(" )\n");#endif    for (j=0; j < D ; j++)      pt[j]=model[M*j+i];    LL=rangeQuery(pVertex,distlim,pt,D);    if (!LL) {      *L=0;      (*pts_in_range)=NULL;#ifdef DEBUG_RUN_RANGE_SEARCH      mexPrintf("Null LL\n");#endif    }     else {      cur=LL;      count=0;      while (cur){	cur=cur->right; count++;      }#ifdef DEBUG_RUN_RANGE_SEARCH      mexPrintf("Found %d points\n",count);#endif      *L=count;      (*indices) = (unsigned int *) malloc (sizeof(unsigned int)*count);      (*pts_in_range) = (double *) malloc (sizeof(double) *count*D);      cur=LL;      count=0;      while(cur){	(*indices)[count] = cur->index;	for (j=0; j < D; j++) {	  (*pts_in_range)[j*(*L)+count] = cur->pt[j];	}	tmp=cur;	cur=cur->right;	free(tmp->pt);	free(tmp);	count++;      }    }  }  free(pt);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人免费高清| 欧美综合色免费| 一区二区三区四区av| 欧美一区二区人人喊爽| 成人精品免费看| 奇米四色…亚洲| 一区二区在线观看视频| 久久精品一级爱片| 5858s免费视频成人| 91在线丨porny丨国产| 狠狠色综合色综合网络| 亚洲国产欧美日韩另类综合| 日本一区二区三区免费乱视频| 在线播放国产精品二区一二区四区| av一二三不卡影片| 国产美女一区二区三区| 日韩精品高清不卡| 伊人色综合久久天天| 国产精品久久久久久妇女6080| 精品国产精品一区二区夜夜嗨| 欧美久久久一区| 欧美午夜视频网站| 一本久久a久久精品亚洲| 波多野结衣欧美| 国产成人h网站| 国产福利91精品一区二区三区| 激情丁香综合五月| 久久精品国产99国产| 日韩不卡一区二区| 婷婷中文字幕综合| 丝袜亚洲另类丝袜在线| 午夜在线电影亚洲一区| 亚洲午夜免费福利视频| 亚洲综合色噜噜狠狠| 亚洲精品伦理在线| 亚洲男人电影天堂| 一区二区三区日韩精品视频| 亚洲欧美色图小说| 亚洲欧美另类久久久精品| 亚洲精品一二三四区| 亚洲自拍偷拍九九九| 亚洲小说欧美激情另类| 亚洲一区二区三区视频在线| 一区二区三区欧美| 亚洲午夜电影网| 午夜精品视频在线观看| 日韩国产一二三区| 精品在线播放免费| 国产成人av资源| 91麻豆蜜桃一区二区三区| 日本道在线观看一区二区| 欧美日韩国产经典色站一区二区三区| 欧美午夜精品一区| 日韩欧美一区二区视频| 久久久精品中文字幕麻豆发布| 国产情人综合久久777777| 亚洲天堂免费看| 亚洲国产精品天堂| 九色porny丨国产精品| 成人激情小说网站| 91国产免费看| 欧美一区2区视频在线观看| 久久嫩草精品久久久精品一| 国产精品高潮久久久久无| 亚洲国产一区二区三区| 久久99国内精品| 99国产精品99久久久久久| 欧美三级视频在线播放| 精品久久久久久综合日本欧美| 中文字幕的久久| 午夜视频一区二区三区| 国产suv一区二区三区88区| 在线观看免费视频综合| 精品剧情在线观看| 亚洲另类在线制服丝袜| 久久丁香综合五月国产三级网站| yourporn久久国产精品| 欧美精品 国产精品| 国产丝袜在线精品| 亚洲 欧美综合在线网络| 国产成人av自拍| 9191成人精品久久| 国产精品国产三级国产aⅴ原创| 五月婷婷久久丁香| 成人午夜伦理影院| 91精品国产综合久久精品麻豆| 中文字幕第一区二区| 婷婷六月综合网| av一二三不卡影片| 精品福利av导航| 午夜精品久久久久久久| 成人亚洲一区二区一| 欧美一区二区三区思思人| 日韩理论片在线| 国产毛片精品国产一区二区三区| 欧美色图激情小说| 中文字幕一区在线观看视频| 九九九精品视频| 欧美日韩黄色影视| 国产精品色在线观看| 伦理电影国产精品| 欧美在线999| 中文字幕一区不卡| 国产精品99久久久久久有的能看 | 欧美日精品一区视频| 国产偷国产偷精品高清尤物| 日韩在线卡一卡二| 91麻豆精东视频| 久久久国产精品麻豆| 日本成人在线不卡视频| 欧美三级中文字幕在线观看| 亚洲婷婷在线视频| 成人av免费在线观看| 久久久久99精品一区| 精品亚洲欧美一区| 7777精品伊人久久久大香线蕉完整版| 一区二区三区高清在线| 久久精品国产99| 日韩一区二区在线看片| 亚洲电影视频在线| 欧美午夜精品理论片a级按摩| 亚洲色图欧美激情| 一本久道中文字幕精品亚洲嫩| 国产精品久久久久aaaa樱花| 国产99久久久国产精品| 久久午夜免费电影| 国产麻豆成人精品| xnxx国产精品| 国产精品一区二区久久不卡 | 精品欧美一区二区三区精品久久 | 国产亚洲精品超碰| 国产精一区二区三区| 国产日韩一级二级三级| 国产寡妇亲子伦一区二区| 国产色产综合色产在线视频| 国产精品456露脸| 国产精品色在线| 99在线精品视频| 夜夜嗨av一区二区三区中文字幕| 色素色在线综合| 亚洲福利一二三区| 欧美一区二区三区喷汁尤物| 日本欧洲一区二区| 日韩精品一区二区三区三区免费| 久久99久久精品欧美| 久久久精品黄色| 97se亚洲国产综合自在线| 亚洲另类春色校园小说| 欧美日韩高清在线| 精品一区二区影视| 国产精品视频yy9299一区| 色综合天天综合网天天狠天天| 亚洲自拍偷拍综合| 日韩欧美国产综合| 成人综合婷婷国产精品久久蜜臀 | 欧美一卡二卡在线| 麻豆精品一二三| 日本一区二区免费在线| 97久久人人超碰| 石原莉奈一区二区三区在线观看 | 国产日韩欧美激情| 99久久婷婷国产| 午夜私人影院久久久久| 2020日本不卡一区二区视频| 国产成人综合视频| 日韩理论片在线| 7777精品伊人久久久大香线蕉| 精品写真视频在线观看| 国产精品久久久久久亚洲伦| 欧美日韩亚洲综合| 黑人巨大精品欧美黑白配亚洲| 亚洲视频一二区| 91精品国产乱| 99久久精品免费看国产免费软件| 亚洲mv在线观看| 国产欧美va欧美不卡在线| 欧美性色黄大片手机版| 国产在线视频一区二区三区| 亚洲精品免费看| 久久久久亚洲蜜桃| 欧美午夜寂寞影院| 丁香婷婷综合色啪| 天天亚洲美女在线视频| 国产精品国产三级国产aⅴ中文| 欧美日本一区二区三区四区| 国产高清久久久| 日韩av在线发布| 亚洲男人天堂一区| 欧美zozo另类异族| 欧美性色综合网| 97精品电影院| 精品一区二区三区蜜桃| 亚洲高清不卡在线| 亚洲三级在线免费| 国产性天天综合网| 欧美成人video| 欧美日韩国产综合视频在线观看| 成人教育av在线| 国产精品自拍毛片| 美女诱惑一区二区|