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

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

?? calcdhatsc.c

?? 一個計算多維定標(MDS)的matlab源代碼
?? C
字號:
#include "d:\matlab\extern\include\mex.h"
#include <math.h>
 
calcdhatsc( double *DH,
            int    ns,
			
            double *DO,
			
			double *inblock,
			double *ave,
			double *sum,
			double *nmem     )
{
  int     i,j,nblocks,blockactive,ups,downs,upa,reference,nmem1,nmem2,whatblock;
  double  value,av,sum1,sum2;

  /* Kruskal's upward-downward algorithm in C */

  /* start with the finest partition possible; every point is in one block */
  nblocks = ns;
  for (i=0; i<ns; i++)
  {
	 /* the inblock has a different interpretation from the MATLAB implementation:
	    every entry i in this array is filled with the block number that it is a member of */

	 *(inblock + i) = (double) i;
     value          = *( DO + i);
     /* square the distances */
	 
	 /*
	 *(ave	   + i) = value * value;
	 *(sum     + i) = value * value;
	 */

	 /* DO NOT square the distances */ 
	 *(ave	   + i) = value;
	 *(sum     + i) = value;

     *(nmem    + i) = (double) 1;
  }

  /* do the iterative process until the highest-block is up and down satisfied */
  blockactive  = 0;	/* in c, start with zero index */

  ups          = 0;
  downs        = 1;
  upa          = 1;

  while ((blockactive+1 < nblocks) || (ups==0) || (downs==0))
  { 
    /* is the current block up or downactive? */
    if (upa==1)
	{
       /* is the current block upsatisfied ? */
       ups = 1; /* assume it is satisfied */
       if (blockactive+1 < nblocks)
       {  
		  if ( *( ave+blockactive+1 ) < *( ave+blockactive ) )
          {
			 ups = 0;
          }
       }
      
       /* if the block is upsatisfied then the active block becomes downactive */
       if (ups == 1)
	   {
          upa = 0;
       }
		  else
	   {
	      /* if not, the active block is joined with the next higher block  */
          
          /* MATLAB code:
              members1 = B(blockactive).mem;
		      members2 = B(blockactive+1).mem;
              B(blockactive).mem  = union( members1 , members2 );

              the blocks with numbers "blockactive" and "blockactive+1" are joined
              in the block with number "blockactive";
              this means that all references to "blockactive+1 should now be changed to 
              blockactive
		  */

		  for (i=0; i<ns; i++)
          {
			  reference = (int) *( inblock+i );

              /* decrement all references higher than blockactive+1 */ 
              if (reference>=blockactive+1)
              {
				 *( inblock+i ) = (double) reference - 1;
              }
          }

          sum1     = *( sum+blockactive  );
          nmem1    = *( nmem+blockactive );
     
          sum2     = *( sum+blockactive+1);
          nmem2    = *( nmem+blockactive+1);
      
          *(sum+blockactive)  = sum1 + sum2;
          *(nmem+blockactive) = nmem1 + nmem2;
          *(ave+blockactive)  = (sum1 + sum2) / (nmem1 + nmem2);
      
          /* and now move all the blocks one downward */
          if (blockactive<=nblocks-3)
          {
             for (j=blockactive+1; j<=nblocks-2; j++)
             {
			   *( sum+j  ) = *( sum+j+1  );
			   *( ave+j  ) = *( ave+j+1  );
               *( nmem+j ) = *( nmem+j+1 );
             }
          }
         
          nblocks--;
          
          /* and the new, larger block becomes downactive */
          upa = 0;
		}
    }   
       else /* current block is downactive */
    {
       /* is the current block down satisfied ? */
       downs = 1; /* assume it is satisfied */
       if (blockactive > 0)
	   {
          if ( *( ave+blockactive-1 ) > *( ave+blockactive ) )
          {
             downs = 0;
          }
       }
      
       /* if the block is downsatisfied then the active block becomes upactive */
       if ( downs == 1 )
       {
          upa = 1;
       }
          else
       {
          /* if not, the active block is joined with the next lower block */
          
		  /* MATLAB code:
              members1 = B(blockactive).mem;
              members2 = B(blockactive-1).mem;
		      B(blockactive-1).mem  = union( members1 , members2 );

              decrement all references >= blockactive 
		  */

          for (i=0; i<ns; i++)
          {
			 reference = (int) *( inblock+i );

             if (reference >= blockactive)
             {
                *( inblock+i) = (double) reference-1;
             }
		  }

          sum1     = *(sum+blockactive);
          nmem1    = *(nmem+blockactive);
          
          sum2     = *(sum+blockactive-1);
          nmem2    = *(nmem+blockactive-1);
          
          *(sum+blockactive-1)  = sum1 + sum2;
          *(nmem+blockactive-1) = nmem1 + nmem2;
          *(ave+blockactive-1)  = (sum1 + sum2) / (nmem1 + nmem2);
      
          /* and now move all the blocks, including the active block one downward */
          if (blockactive<=nblocks-2)
          {
             for (j=blockactive; j<=nblocks-2; j++)
             {
                *( sum+j  ) = *( sum+j+1  );
 			    *( ave+j  ) = *( ave+j+1  );
                *( nmem+j ) = *( nmem+j+1 );
          	 }
          }
         
          blockactive--;
          nblocks--;
          
          /* and the new, larger block becomes upactive */
          upa = 1;
       }
    } 
   
    /* check whether the active block is simultaneously up and down satisfied */
    ups = 1; /* assume it is satisfied */
    if (blockactive+1 < nblocks)
    {
       if ( *( ave+blockactive+1 ) < *( ave+blockactive ) )
       {
          ups = 0;
       }
    }
   
    downs = 1; /* assume it is satisfied */
    if (blockactive > 0)
    {
       if ( *(ave+blockactive-1) > *( ave+blockactive ) )
       {
          downs = 0;
       }
    }
   
    if ((ups==1) && (downs==1))
    {
       /* both up and down-satisfied */
       if (blockactive+1 < nblocks)
       {
          /* transfer to next block */
          blockactive++;
          upa = 1;
       }
    }
  }   


  /* now, fill the DH-array with the block averages */
  for (i=0; i<ns; i++)
  {
    whatblock = (int) *( inblock+i );
    av = *( ave+whatblock );
    *( DH+i ) = av; 
  }

  /* and take the square root of the distances */
  /*
  for (i=0; i<ns; i++)
  {
    *( DH+i ) = sqrt( *( DH+i ) );
  }
  */
}


void mexFunction(  int nlhs, mxArray *plhs[],
				   int nrhs, const mxArray *prhs[] )

{
   double *DH;
   int    ns;
			
   double *DO;
			
   double *inblock;
   double *ave;
   double *sum;
   double *nmem;
   
   int    m,n;
   
   /* the input arguments are:
   0 = ns
   1 = DO
   
   the output arguments are
   0:  DH
   1:  inblock
   2:  ave
   3:  sum
   4:  nmem
   */

   if (nrhs != 2)
   {
      mexErrMsgTxt( "Only two input argument allowed." );
   }
      else if (nlhs != 5) 
   {
      mexErrMsgTxt( "Only five output argument allowed." );
   }
   
   /* the input ns must be a scalar */
   m = mxGetM( prhs[ 0 ] );
   n = mxGetN( prhs[ 0 ] );   
   if (!mxIsDouble( prhs[0]) || mxIsComplex(prhs[0]) || !(m ==1 && n==1)) mexErrMsgTxt("Input ns must be a scalar." );

   ns = mxGetScalar( prhs[ 0 ] );

   /* check the dimensions of the DO array */
   m = mxGetM( prhs[ 1 ] );
   n = mxGetN( prhs[ 1 ] );   
 
   if ((m != ns) || (n != 1)) mexErrMsgTxt("The DO Array has the wrong dimensions." );
   DO = mxGetPr( prhs[ 1 ] );

   /* the output arguments are
   0:  DH
   1:  inblock
   2:  ave
   3:  sum
   4:  nmem

   /* Create matrixes for the two return arguments. */   
   plhs[ 0 ] = mxCreateDoubleMatrix( ns,1, mxREAL );
   plhs[ 1 ] = mxCreateDoubleMatrix( ns,1, mxREAL );
   plhs[ 2 ] = mxCreateDoubleMatrix( ns,1, mxREAL );
   plhs[ 3 ] = mxCreateDoubleMatrix( ns,1, mxREAL );
   plhs[ 4 ] = mxCreateDoubleMatrix( ns,1, mxREAL );
   
   DH      = mxGetPr( plhs[ 0 ] );
   inblock = mxGetPr( plhs[ 1 ] );
   ave     = mxGetPr( plhs[ 2 ] );
   sum     = mxGetPr( plhs[ 3 ] );
   nmem    = mxGetPr( plhs[ 4 ] );
   
   /* call the subroutine */
   calcdhatsc( DH,ns,DO,inblock,ave,sum,nmem );
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合婷婷国产精品久久蜜臀 | 国产成a人亚洲| 一区二区三区四区不卡在线 | 亚洲美女在线一区| 中文在线免费一区三区高中清不卡| 日韩欧美国产午夜精品| 欧美一级免费观看| 91精品一区二区三区在线观看| 欧美精品一二三区| 日韩欧美中文字幕制服| 久久人人97超碰com| 国产精品理伦片| 亚洲精品免费一二三区| 三级影片在线观看欧美日韩一区二区| 五月婷婷激情综合| 狂野欧美性猛交blacked| 国产精品一区二区久激情瑜伽| 国产成人无遮挡在线视频| av资源站一区| 欧美人伦禁忌dvd放荡欲情| 日韩精品中文字幕一区| 亚洲国产成人自拍| 亚洲午夜羞羞片| 蜜桃视频免费观看一区| 处破女av一区二区| 欧美精品在欧美一区二区少妇| 久久亚洲春色中文字幕久久久| 国产精品国产精品国产专区不片| 亚洲一区二区三区四区的| 蜜臀av性久久久久蜜臀av麻豆| 国产不卡视频在线观看| 91国产丝袜在线播放| 日韩免费观看高清完整版| 欧美激情在线观看视频免费| 无码av中文一区二区三区桃花岛| 狠狠色狠狠色合久久伊人| 91亚洲永久精品| 日韩美女一区二区三区| 亚洲免费在线观看视频| 国产麻豆9l精品三级站| 欧美日本高清视频在线观看| ㊣最新国产の精品bt伙计久久| 午夜亚洲国产au精品一区二区| 成人一区在线看| 欧美一二三四区在线| 亚洲最新视频在线播放| 国产精品99久| 日韩免费性生活视频播放| 亚洲男人的天堂在线aⅴ视频| 国产福利一区二区| 日韩美女视频一区二区在线观看| 亚洲精品午夜久久久| 成人黄色小视频| 久久综合999| 男女激情视频一区| 99热精品国产| 国产精品成人网| 国产一区二区三区电影在线观看| 欧美一区二区视频免费观看| 一区二区三区在线免费播放| eeuss鲁一区二区三区| 久久精品欧美一区二区三区不卡| 青青草一区二区三区| 欧美日韩一区在线| 亚洲国产综合91精品麻豆| 日本福利一区二区| 18欧美亚洲精品| 成人黄色大片在线观看| 国产精品美女久久久久久| 粉嫩一区二区三区在线看| 亚洲国产精品二十页| 国产+成+人+亚洲欧洲自线| 欧美成人国产一区二区| 精品制服美女久久| 久久久99精品免费观看不卡| 国产真实乱对白精彩久久| 日韩欧美国产三级电影视频| 国产自产高清不卡| 久久欧美中文字幕| 高清国产午夜精品久久久久久| 国产网站一区二区| 成人av在线影院| 亚洲黄网站在线观看| 欧美日韩一级片网站| 日韩在线卡一卡二| 久久综合色之久久综合| 福利一区二区在线观看| 亚洲天堂网中文字| 欧美日韩五月天| 久久精品国产精品亚洲综合| 久久久久久日产精品| 福利一区在线观看| 精品国产一区二区亚洲人成毛片| 国产精品正在播放| 亚洲女同女同女同女同女同69| 欧美日韩一区成人| 国产在线视频精品一区| 中文字幕一区二区三区四区不卡| 在线观看日韩国产| 激情久久五月天| 亚洲乱码中文字幕| 欧美成人一区二区三区| 成人午夜激情影院| 日韩电影在线免费观看| 久久精品夜色噜噜亚洲a∨| 91麻豆自制传媒国产之光| 午夜视频一区二区| 中文文精品字幕一区二区| 欧美猛男男办公室激情| 国产精品一区二区免费不卡| 亚洲一区二区四区蜜桃| 欧美mv日韩mv亚洲| 91久久精品日日躁夜夜躁欧美| 男女男精品视频| 一区二区三区不卡视频| 久久久久久久综合色一本| 欧美色综合网站| 成人av网址在线观看| 日本最新不卡在线| 亚洲欧美日韩国产综合在线| 精品国产成人系列| 欧美人与z0zoxxxx视频| 91社区在线播放| 国产成人精品免费在线| 日韩综合一区二区| 亚洲免费av网站| 国产精品美女一区二区三区| 精品国产91乱码一区二区三区| 欧美调教femdomvk| 色综合色狠狠综合色| 国产v日产∨综合v精品视频| 精品无码三级在线观看视频| 性做久久久久久久久| 亚洲欧美国产77777| 中文字幕精品—区二区四季| 久久婷婷色综合| 精品国产91乱码一区二区三区| 717成人午夜免费福利电影| 色吊一区二区三区| 一本色道**综合亚洲精品蜜桃冫| 国产在线视频一区二区三区| 久久99精品一区二区三区三区| 日韩av在线免费观看不卡| 亚洲一区二区三区自拍| 亚洲欧美欧美一区二区三区| 国产精品视频免费看| 国产免费观看久久| 欧美国产日本视频| 欧美激情一区在线观看| 国产精品污污网站在线观看| 国产亚洲一区二区在线观看| 久久综合色一综合色88| 久久嫩草精品久久久精品 | 国产精品系列在线播放| 国产综合成人久久大片91| 久草这里只有精品视频| 国内成+人亚洲+欧美+综合在线| 麻豆成人免费电影| 美女视频黄久久| 狠狠色2019综合网| 国产成人av在线影院| 国产超碰在线一区| 99r国产精品| 欧美性生活久久| 欧美xxx久久| 国产情人综合久久777777| 中文字幕亚洲欧美在线不卡| 亚洲少妇30p| 三级成人在线视频| 精品一区二区三区香蕉蜜桃| 国产激情一区二区三区四区| 99re这里只有精品6| 欧美日韩精品二区第二页| 日韩欧美在线一区二区三区| 久久精品人人爽人人爽| 亚洲国产综合91精品麻豆| 久久草av在线| 成人av网站在线| 欧美系列亚洲系列| 久久免费看少妇高潮| 亚洲综合一二三区| 国产九色sp调教91| 在线国产亚洲欧美| 久久先锋影音av鲁色资源| 亚洲精品中文在线影院| 狠狠色狠狠色综合日日91app| 99精品欧美一区二区三区综合在线| 337p亚洲精品色噜噜狠狠| 国产午夜精品一区二区三区四区 | 蜜桃视频在线一区| aa级大片欧美| 精品入口麻豆88视频| 亚洲精品老司机| 精品一区中文字幕| 91福利视频网站| 国产日韩欧美综合在线| 日本亚洲免费观看| 色综合久久综合| 国产精品卡一卡二卡三| 紧缚捆绑精品一区二区|