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

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

?? nstats.c

?? 數(shù)據(jù)挖掘中的apriori算法,很好的代碼
?? C
字號:
/*----------------------------------------------------------------------  File    : nstats.c  Contents: management of normalization statistics  Author  : Christian Borgelt  History : 12.08.2003 file created            12.08.2004 description and parse function added----------------------------------------------------------------------*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <float.h>#include <math.h>#include <assert.h>#include "nstats.h"/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#define BLKSIZE   64            /* block size for parsing *//*----------------------------------------------------------------------  Functions----------------------------------------------------------------------*/NSTATS* nst_create (int dim){                               /* --- create numerical statistics */  NSTATS *nst;                  /* created statistics structure */  double *p;                    /* to organize the memory */  assert(dim > 0);              /* check the function argument */  nst = (NSTATS*)malloc(sizeof(NSTATS) +(6*dim -1) *sizeof(double));  if (!nst) return NULL;        /* create a statistics structure */  nst->dim  = dim;              /* and initialize the fields */  nst->reg  = 0;  nst->offs = p = nst->facs +dim;  nst->mins = p += dim;  nst->maxs = p += dim;         /* organize the vectors */  nst->sums = p += dim;  nst->sqrs = p += dim;  while (--dim >= 0) {          /* traverse the vectors */    nst->mins[dim] = DBL_MAX; nst->maxs[dim] = -DBL_MAX;    nst->sums[dim] = nst->sqrs[dim] = nst->offs[dim] = 0;    nst->facs[dim] = 1;         /* initialize the ranges of values */  }                             /* and the aggregation variables */  return nst;                   /* return created structure */}  /* nst_create() *//*--------------------------------------------------------------------*/void nst_delete (NSTATS *nst){ free(nst); }                  /* --- delete numerical statistics *//*--------------------------------------------------------------------*/void nst_reg (NSTATS *nst, const double *vec, double weight){                               /* --- register a data vector */  int    i;                     /* loop variable */  double *min, *max;            /* to traverse the min./max. values */  double *sum, *sqr;            /* to traverse the value sums */  double *off, *fac;            /* to traverse the offsets/scales */  double t;                     /* temporary buffer */  assert(nst && vec);           /* check the function arguments */  sum = nst->sums;              /* get the vectors for the sums */  sqr = nst->sqrs;              /* and the sums of squares */  if (!vec) {                   /* if to terminate registration */    off = nst->offs;            /* get the offsets and */    fac = nst->facs;            /* the scaling factors */    if (nst->reg <= 0)          /* if no patterns are registered */      for (i = nst->dim; --i >= 0; ) { off[i] = 0; fac[i] = 1; }    else {                      /* if patterns have been registered */      for (i = nst->dim; --i >= 0; ) {      /* traverse the vectors */        off[i] = sum[i] /nst->reg;        t      = sqr[i] -off[i] *sum[i];        fac[i] = (t > 0) ? sqrt(nst->reg /t) : 1;      }                         /* estimate the parameters */    }    if (weight < 0) {           /* if to reinitialize registration */      for (i = nst->dim; --i >= 0; )        sum[i] = sqr[i] = 0;    /* reinitialize the vectors */      nst->reg = 0;             /* and the pattern counter */    } }  else {                        /* if to register a data vector */    min = nst->mins;            /* get the minimal */    max = nst->maxs;            /* and the maximal values */    for (i = nst->dim; --i >= 0; ) {      if (vec[i] < min[i]) min[i] = vec[i];      if (vec[i] > max[i]) max[i] = vec[i];      sum[i] += vec[i];         /* update the ranges of values */      sqr[i] += vec[i] *vec[i]; /* and sum the values */    }                           /* and their squares */    nst->reg += weight;         /* count the pattern */  }}  /* nst_reg() *//*--------------------------------------------------------------------*/void nst_range (NSTATS *nst, int idx, double min, double max){                               /* --- set range of values */  int i;                        /* loop variable */  assert(nst && (idx < nst->dim));  /* check the arguments */  if (idx < 0) { i = nst->dim; idx = 0; }  else         { i = idx +1; }  /* get index range to set */  while (--i >= idx) {          /* and traverse it */    nst->mins[i] = min;         /* set the minimal */    nst->maxs[i] = max;         /* and the maximal value */  }                             /* for all dimensions in range */}  /* nst_range() *//*--------------------------------------------------------------------*/void nst_expand (NSTATS *nst, int idx, double factor){                               /* --- expand range of values */  int    i;                     /* loop variable */  double t;                     /* change of minimal/maximal value */  assert(nst                    /* check the function arguments */     && (idx < nst->dim) && (factor >= 0));  if (idx < 0) { i = nst->dim; idx = 0; }  else         { i = idx +1; }  /* get index range to expand */  while (--i >= idx) {          /* and traverse it */    t = (nst->maxs[i] -nst->mins[i]) *(factor -1) *0.5;    nst->mins[i] -= t;          /* adapt the minimal */    nst->maxs[i] += t;          /* and   the maximal value */  }                             /* for all dimensions in range */}  /* nst_expand() *//*--------------------------------------------------------------------*/void nst_scale (NSTATS *nst, int idx, double off, double fac){                               /* --- set (linear) scaling */  int i;                        /* loop variable */  assert(nst && (idx < nst->dim));  /* check the arguments */  if (idx < 0) { i = nst->dim; idx = 0; }  else         { i = idx +1; }  /* get index range to set */  while (--i >= idx) {          /* and traverse it */    nst->offs[i] = off;         /* set the offset */    nst->facs[i] = fac;         /* and the scaling factor */  }                             /* for all dimensions in range */}  /* nst_scale() *//*--------------------------------------------------------------------*/void nst_norm (NSTATS *nst, const double *vec, double *res){                               /* --- normalize a data vector */  int    i;                     /* loop variable */  double *off, *fac;            /* to traverse the scaling parameters */  assert(nst && vec && res);    /* check the function arguments */  off = nst->offs +(i = nst->dim);  fac = nst->facs + i;          /* get the scaling parameters */  res += i; vec += i;           /* and the data vectors */  while (--i >= 0) *--res = *--fac * (*--vec - *--off);}  /* nst_norm() */             /* scale the vector *//*--------------------------------------------------------------------*/void nst_inorm (NSTATS *nst, const double *vec, double *res){                               /* --- inverse normalize a vector */  int    i;                     /* loop variable */  double *off, *fac;            /* to traverse the scaling parameters */  assert(nst && vec && res);    /* check the function arguments */  off = nst->offs +(i = nst->dim);  fac = nst->facs + i;          /* get the scaling parameters */  res += i; vec += i;           /* and the data vectors */  while (--i >= 0) *--res = *--vec / *--fac + *--off;}  /* nst_inorm() */            /* scale the vector *//*--------------------------------------------------------------------*/void nst_center (NSTATS *nst, double *vec){                               /* --- get center of data space */  int    i;                     /* loop variable */  double *min, *max;            /* to traverse the ranges */  assert(nst && vec);           /* check the function arguments */  min = nst->mins;              /* get the range variables, */  max = nst->maxs;              /* traverse the dimensions, */  for (i = nst->dim; --i >= 0;) /* and compute the center vector */    vec[i] = 0.5 *(max[i] +min[i]);}  /* nst_center() *//*--------------------------------------------------------------------*/void nst_spans (NSTATS *nst, double *vec){                               /* --- get spans of dimensions */  int    i;                     /* loop variable */  double *min, *max;            /* to traverse the ranges */  assert(nst && vec);           /* check the function arguments */  min = nst->mins;              max = nst->maxs;              /* get the range variables, */   for (i = nst->dim; --i >= 0;) /* traverse the dimensions, */     vec[i] = max[i] -min[i];    /* and compute the spans */}  /* nst_spans() *//*--------------------------------------------------------------------*/int nst_desc (NSTATS *nst, FILE *file, const char *indent, int maxlen){                               /* --- describe norm. statistics */  int  i;                       /* loop variable */  int  pos, ind;                /* position in output line */  char buf[64];                 /* buffer for output */  for (i = nst->dim; --i >= 0;) /* check for non-identity scaling */    if ((nst->offs[i] != 0) || (nst->facs[i] != 1)) break;  if (i < 0) return 0;          /* if all identity scaling, abort */  fputs(indent,        file);   /* write the indentation and */  fputs("scales   = ", file);   /* start the scaling parameters */  for (ind = 0; indent[ind]; ind++);  pos = ind +9;                 /* compute the starting position */  for (i = 0; i < nst->dim; i++) {    pos += sprintf(buf, "[% g, %g]", nst->offs[i], nst->facs[i]);    if (i > 0) {                /* format the scaling parameters */      if (pos +3 <= maxlen) { fputs(", ", file);      pos += 2;   }      else { fprintf(file, ",\n%s         ", indent); pos  = ind; }    }                           /* print separator and indentation */    fputs(buf, file);           /* print formatted offset and factor */  }  fputs(";\n", file);           /* terminate the list */  return ferror(file) ? -1 : 0; /* return the write status */}  /* nst_desc() *//*--------------------------------------------------------------------*/#ifdef NST_PARSEstatic int _parse (SCAN *scan, int dim, double **buf){                               /* --- parse normalization statistics */  int    k, n = 0;              /* loop variable, counter */  double *p;                    /* to access the statistics elements */  assert(scan);                 /* check the function arguments */  if ((sc_token(scan) != T_ID)  /* check whether 'scales' follows */  ||  (strcmp(sc_value(scan), "scales") != 0))    ERR_STR("scales");          /* if not, abort the function */  GET_TOK();                    /* consume 'scales' */  GET_CHR('=');                 /* consume '=' */  for (k = 0; (dim <= 0) || (k < dim); k++) {    if (k > 0) { GET_CHR(',');} /* if not first, consume ',' */    if (k >= n) {               /* if the statistics vector is full */      if (dim > 0) n  = dim;    /* compute the new vector size */      else         n += (n > BLKSIZE) ? n >> 1 : BLKSIZE;      p = (double*)realloc(*buf, (n+n) *sizeof(double));      if (!p) ERROR(E_NOMEM);   /* enlarge the buffer vector */      *buf = p;                 /* and set the new vector, */    }                           /* then note factor and offset */    p = *buf +k +k;             /* get the element to set */    GET_CHR('[');               /* consume '[' */    if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP);    p[0] = strtod(sc_value(scan), NULL);    GET_TOK();                  /* consume the offset */    GET_CHR(',');               /* consume '[' */    if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP);    p[1] = strtod(sc_value(scan), NULL);    GET_TOK();                  /* consume the factor */    GET_CHR(']');               /* consume '[' */    if ((dim <= 0) && (sc_token(scan) != ',')) {      k++; break; }             /* check for more scaling params. */  }  GET_CHR(';');                 /* consume ';' */  return k;                     /* return 'ok' */}  /* _parse() *//*--------------------------------------------------------------------*/NSTATS* nst_parse (SCAN *scan, int dim){                               /* --- parse normalization statistics */  NSTATS *nst;                  /* created normalization statistics */  double *buf = NULL;           /* buffer for reading */  assert(scan);                 /* check the function arguments */  dim = _parse(scan,dim, &buf); /* parse normalization statistics */  if (dim < 0) { if (buf) free(buf); return NULL; }  nst = nst_create(dim);        /* create a statistics structure */  if (!nst)    { free(buf); return NULL; }  for (buf += dim +dim; --dim >= 0; ) {    nst->facs[dim] = *--buf;    /* copy the buffered values */    nst->offs[dim] = *--buf;    /* into the corresponding vectors */  }  free(buf);                    /* delete the read buffer */  return nst;                   /* return the created structure */}  /* nst_parse() */#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产aⅴ综合色| 亚洲免费观看高清完整版在线观看熊| 中文字幕在线不卡国产视频| 国产米奇在线777精品观看| 国产午夜亚洲精品不卡| 午夜精品久久久久| 99久久精品国产网站| 欧美日本国产一区| 亚洲自拍偷拍图区| 国产.欧美.日韩| 亚洲色大成网站www久久九九| 欧美精品黑人性xxxx| 青青草精品视频| 一本大道av伊人久久综合| 久久久久高清精品| 另类小说图片综合网| 欧美色手机在线观看| 《视频一区视频二区| 国产白丝网站精品污在线入口| 91精品国产综合久久久久久久| 一区二区三区四区五区视频在线观看| 国产 欧美在线| 国产丝袜欧美中文另类| 在线免费精品视频| 中文字幕在线观看不卡| 粉嫩aⅴ一区二区三区四区五区| 日韩欧美成人午夜| 蜜桃精品视频在线观看| 波多野结衣欧美| 日韩毛片精品高清免费| 99国内精品久久| 亚洲欧美怡红院| 在线免费av一区| 亚洲精品免费一二三区| av爱爱亚洲一区| 夜色激情一区二区| 在线成人av网站| 精品亚洲免费视频| 国产精品丝袜久久久久久app| 成人aa视频在线观看| 国产精品久久久久毛片软件| 99久久久国产精品免费蜜臀| 亚洲成人av一区二区三区| 日韩精品一区二区三区在线播放| 99国产精品久久久久| 久久久久久免费| 狠狠色丁香久久婷婷综| 91精品在线麻豆| 国产不卡高清在线观看视频| 天天影视色香欲综合网老头| 全国精品久久少妇| 国产成人午夜电影网| 日韩成人一区二区| 欧美一卡二卡三卡| 久久99久久精品欧美| 欧美mv和日韩mv国产网站| 国产自产高清不卡| 国产欧美日韩亚州综合| 成人高清av在线| 亚洲免费观看高清在线观看| 99热精品一区二区| 午夜欧美大尺度福利影院在线看| 国产欧美中文在线| 欧美一卡二卡三卡| 日本乱码高清不卡字幕| 日本视频免费一区| 玉足女爽爽91| 亚洲国产另类av| 亚洲欧美一区二区不卡| 久久国产精品99久久久久久老狼| 久久不见久久见免费视频7| 成人性生交大片| 色妞www精品视频| 久久亚洲春色中文字幕久久久| 99热精品国产| 欧洲一区二区av| 精品国产电影一区二区| 国产精品国产a| 美日韩黄色大片| 91浏览器打开| 2024国产精品视频| 亚洲成av人在线观看| 国产白丝精品91爽爽久久| 欧美日韩在线播放三区| 国产亚洲欧美色| 日韩电影在线免费看| 成人国产精品免费网站| 日韩一区二区电影| 亚洲一区二区三区四区在线免费观看| 狠狠色丁香婷综合久久| 欧美综合视频在线观看| 国产日韩v精品一区二区| 欧美aaaaaa午夜精品| 91福利视频在线| 国产亚洲欧美在线| 国产精品久久午夜夜伦鲁鲁| 国产精品日日摸夜夜摸av| 中文字幕欧美国产| 自拍偷拍欧美激情| 久久精品国产秦先生| 成人免费电影视频| 亚洲精品v日韩精品| 91小视频在线免费看| 日本免费新一区视频| 136国产福利精品导航| 中文久久乱码一区二区| 欧美日韩国产一区二区三区地区| 国产精品自产自拍| 日韩欧美亚洲国产精品字幕久久久| 日日夜夜精品视频免费| 欧美撒尿777hd撒尿| 国产麻豆视频精品| 午夜久久久久久| 中文字幕久久午夜不卡| 欧美日本视频在线| 91同城在线观看| 国产另类ts人妖一区二区| 亚洲成人午夜影院| 最新久久zyz资源站| 精品久久五月天| 8x8x8国产精品| 91片在线免费观看| 国产成人夜色高潮福利影视| 日韩国产欧美在线播放| 亚洲乱码精品一二三四区日韩在线| 久久亚洲精华国产精华液| 在线成人免费观看| 欧美综合在线视频| 色哦色哦哦色天天综合| 不卡的电视剧免费网站有什么| 国产一区二区免费看| 秋霞电影一区二区| 国产精品亚洲第一区在线暖暖韩国| 国产成人高清在线| 日韩av网站在线观看| 亚洲国产精品久久一线不卡| 亚洲欧洲av在线| 欧美激情中文字幕| 久久久国产一区二区三区四区小说 | 国产亚洲综合性久久久影院| 欧美日韩免费不卡视频一区二区三区| av电影在线观看一区| 丁香六月综合激情| 国产乱国产乱300精品| 狠狠色狠狠色合久久伊人| 久久精品国产一区二区三 | 亚洲乱码国产乱码精品精98午夜| 国产精品卡一卡二| 国产精品电影院| 国产精品夫妻自拍| 国产精品久久久久久久午夜片| 欧美国产一区二区| 国产精品福利在线播放| 国产精品污www在线观看| 久久久国际精品| 欧美国产乱子伦 | 欧美丰满嫩嫩电影| 欧美精品精品一区| 日韩欧美一区二区在线视频| 欧美理论片在线| 日韩午夜电影在线观看| 日韩欧美在线综合网| 精品国产百合女同互慰| 久久先锋资源网| 欧美激情一区二区三区在线| 日本一二三不卡| 亚洲欧美一区二区在线观看| 亚洲精品日韩一| 亚洲第一福利视频在线| 亚洲成av人片在www色猫咪| 午夜欧美一区二区三区在线播放| 日韩成人伦理电影在线观看| 另类小说一区二区三区| 国产经典欧美精品| proumb性欧美在线观看| 色婷婷综合久久久中文一区二区| 久久一区二区视频| 国产精品午夜免费| 一区二区三区四区激情| 亚洲电影视频在线| 蜜乳av一区二区| 国产成a人无v码亚洲福利| 色婷婷综合久色| 欧美一区二区播放| 久久久精品国产免大香伊| 亚洲女厕所小便bbb| 日韩中文字幕亚洲一区二区va在线| 久久不见久久见免费视频7| 国产传媒欧美日韩成人| 色偷偷久久一区二区三区| 欧美精品一二三| 久久亚洲精精品中文字幕早川悠里| 国产精品狼人久久影院观看方式| 亚洲永久免费视频| 伦理电影国产精品| 99久久精品国产导航| 在线观看91av| 中文字幕中文在线不卡住| 亚洲18女电影在线观看| 国产高清久久久|