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

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

?? kriging.c

?? Kriging差值的實現(xiàn)方法
?? C
字號:
/*                   Kriging Interpolator                                            written by Chao-yi Lang                     July, 1995                     lang@cs.cornell.edu*/ #include <dx/dx.h>#include <stdio.h>#include <string.h>#include <math.h>char krig_fn[]="_krig.dx";char vari_fn[]="_vari.dx";float *D,*weight;float result[2];float kriging_result(float *V, float i_f, float j_f, int dim, float *pos ,        float *Z_s, int mode,int a, float c0, float c1);int kriging(int *range, int mode, int item, float *Z_s, int *resol,            float *pos, float c0, float c1,float a);int *get_range(float *pos, int *range, int item);Error m_Kriging(Object *in, Object *out){    Array a1,a2,a3,a4;    Object o = NULL;    float x,*pos,*value,nugget,range_a,sill;    int i, *resol_a, *range, range_default[4];    char *method_a;    char method_default[] = "exponential";        int item, n, n1, rank, rank1, shape[3], shape1[3], method;    Category category;    Type type;    /* copy the structure of in[0] */    if (!in[0])  {          DXSetError(ERROR_BAD_PARAMETER, "missing data parameter");          goto error;    }    if ( DXGetObjectClass(in[0]) != CLASS_FIELD) {          DXSetError(ERROR_BAD_PARAMETER, "data is not a field");          goto error;    }    a1 = (Array) DXGetComponentValue((Field) in[0], "data");    if (!a1) {          DXSetError(ERROR_MISSING_DATA, "field has no data");          return ERROR;    }    DXGetArrayInfo(a1, &n, &type, &category, &rank, shape);    value = (float *) DXGetArrayData(a1);    a1 = (Array) DXGetComponentValue((Field) in[0], "positions");    if (!a1) {          DXSetError(ERROR_MISSING_DATA, "field has no positions");          return ERROR;    }    DXGetArrayInfo(a1, &n1, &type, &category, &rank1, shape1);    if ((rank1==1) && (shape1[0]==2)) {          pos = (float *) DXGetArrayData(a1);    }    else {        DXSetError(ERROR_MISSING_DATA, "input field must be rank:1 shape:2");        return ERROR;    }    if (!in[1]) {	range = get_range( pos, range_default, n1*2 );    }    else {        if ( DXGetObjectClass(in[1]) != CLASS_ARRAY) {            DXSetError(ERROR_BAD_PARAMETER,"bad class");            goto error;        }        a2 = (Array)DXCopy(in[1], COPY_STRUCTURE);        if (!a2)            goto error;        if ( DXGetArrayClass(a2) != CLASS_ARRAY) {            DXSetError(ERROR_BAD_PARAMETER,"bad array class");            goto error;        }        DXGetArrayInfo(a2,&item,&type,&category,&rank,shape);        if (item != 2) {            DXSetError(ERROR_BAD_PARAMETER, "range error");            goto error;        }        range = (int *) DXGetArrayData(a2);    }    if (!in[2]) {        DXSetError(ERROR_BAD_PARAMETER, "missing data parameter");        goto error;    }    if ( DXGetObjectClass(in[2]) != CLASS_ARRAY) {        DXSetError(ERROR_BAD_PARAMETER,"resolution error");        goto error;    }    a1 = (Array)DXCopy(in[2], COPY_STRUCTURE);    if (!a1)        goto error;    DXGetArrayInfo(a1,&item,&type,&category,&rank,shape);    resol_a = (int *) DXGetArrayData(a1);    if (item != 1) {        DXSetError(ERROR_BAD_PARAMETER, "resolution error");        goto error;    }    if (!in[3])         method_a = method_default;    else if ( DXGetObjectClass(in[3]) == CLASS_STRING )     	    DXExtractString(in[3], &method_a);    	 else {            DXSetError(ERROR_BAD_PARAMETER,"method should be string");            goto error;    	 }    if ( strcasecmp( method_a, "spherical") == 0       || strcasecmp( method_a, "1") == 0)        method = 1;    else if ( strcasecmp( method_a, "exponential") == 0       || strcasecmp( method_a, "2") == 0)        method = 2;    else if ( strcasecmp( method_a, "gaussian") == 0       || strcasecmp( method_a, "3") == 0)        method = 3;    else {        DXSetError(ERROR_BAD_PARAMETER,"input method error");        goto error;    }        if (!in[4])  {        DXSetError(ERROR_BAD_PARAMETER, "missing data parameter");        goto error;    }    else         DXExtractFloat(in[4], &range_a);             if (!in[5])  {        DXSetError(ERROR_BAD_PARAMETER, "missing data parameter");        goto error;    }    else         DXExtractFloat(in[5], &nugget);             if (!in[6]) {         DXSetError(ERROR_BAD_PARAMETER, "missing data parameter");        goto error;    }    else         DXExtractFloat(in[6], &sill);     kriging(range, method, n1, value, resol_a, pos, nugget, sill-nugget,            range_a);        out[0]=DXImportDX(krig_fn,NULL,NULL,NULL,NULL);    out[1]=DXImportDX(vari_fn,NULL,NULL,NULL,NULL);    unlink(krig_fn);    unlink(vari_fn);    return OK;    error:    return ERROR;}int kriging(int *range, int mode, int item, float *Z_s, int *resol,            float *pos, float c0, float c1, float a) {    FILE *opt, *opt1;    int dim,i,j,*ipiv,info;    float xs,ys,zs,i_f,j_f,k,l,cnt_x,cnt_y;    float begin_row,begin_col,end_row,end_col,*V,*Cd,*work,test_t;    int resol_x, resol_y;    /* initialize values */    begin_row = (float) *(range);    begin_col = (float) *(range+1);    end_row = (float) *(range+2);    end_col = (float) *(range+3);    dim = item + 1;    resol_x = *(resol);    resol_y = *(resol+1);        /* allocate V array */    V = (float *) DXAllocate (sizeof (float) * dim * dim );    D = (float *) DXAllocate (sizeof (float) * dim);    weight = (float *) DXAllocate (sizeof (float) * dim);    /* allocate Cd array */    Cd = (float *) DXAllocate (sizeof (float) * dim * dim );    /* caculate the distance between sample datas put into Cd array*/    for ( i=0; i< dim-1 ;i++)        for (j=i; j < dim-1 ; j++) {            test_t =( pos[i*2]-pos[j*2] )*( pos[i*2]-pos[j*2])+                    ( pos[i*2+1]-pos[j*2+1] )*( pos[i*2+1]-pos[j*2+1] );            Cd[i*dim+j]= sqrt( test_t );        }    for ( i=0; i< dim-1 ;i++) {        V[i*dim+dim-1]= 1;        V[(dim-1)*(dim)+i]=1;    }    V[(dim-1)*(dim)+i] = 0;    /* caculate the variogram of sample datas and put into  V array */    for ( i=0; i< dim-1 ;i++)        for (j=i; j < dim-1; j++) {            switch( mode ) {                case 1 : /* Spher mode */                         if ( Cd[i*dim+j] < a )                            V[i*dim+j] = V[j*dim+i] = c0 + c1*(                                  1.5*Cd[i*dim+j]/a - 0.5*(Cd[i*dim+j]/a)*                                  (Cd[i*dim+j]/a)*(Cd[i*dim+j]/a));                         else                            V[i*dim+j] = V[j*dim+i] = c0 + c1;                         break;                case 2 : /* Expon mode */                         V[i*dim+j] = V[j*dim+i] = c0 + c1 *( 1 -                                   exp(-3*Cd[i*dim+j]/a) );                         break;                case 3 : /* Gauss mode */                         V[i*dim+j] = V[j*dim+i] = c0 + c1 *( 1 -                                  exp(-3*Cd[i*dim+j]*Cd[i*dim+j]/a/a));                         break;                default: fprintf(stderr, " mode error \n");                         break;            }        }    /* release Cd array */    DXFree(Cd);    ipiv = (int *) DXAllocate (sizeof(int)*dim);    work = (float *) DXAllocate (sizeof(float)*dim);    /* call inverse matrix function to inverse matrix C */    sgetrf_(&dim,&dim,V,&dim,ipiv,&info);    if ( info != 0) fprintf(stderr, "matrix error!!\n");    sgetri_(&dim,V,&dim,ipiv,work,&dim,&info);    if ( info != 0) fprintf(stderr, "matrix error!!\n");    DXFree(ipiv);    DXFree(work);    /* create a temperate file to put result */    opt = fopen(krig_fn,"w");    if ( opt == NULL ) {        fprintf(stderr,"error open output file\n");        return(-1);    }    opt1 = fopen(vari_fn,"w");    if ( opt1 == NULL ) {        fprintf(stderr,"error open output file\n");        return(-1);    }    /* for loop for each point of the estimated block */    cnt_x = (end_row - begin_row)/ (float) resol_x;    cnt_y = (end_col - begin_col)/ (float) resol_y;    fprintf(opt,"object 1 class gridconnections counts %d %d\n",            resol_x+1,resol_y+1);    fprintf(opt,"attribute \"element type\" string \"quads\"\n");    fprintf(opt,"attribute \"ref\" string \"positions\"\n");    fprintf(opt,"#\n");    fprintf(opt,"object 2 class array type float rank 1 shape 2 items %d data follows\n",(resol_x+1)*(resol_y+1));    fprintf(opt1,"object 1 class gridconnections counts %d %d\n",            resol_x+1,resol_y+1);    fprintf(opt1,"attribute \"element type\" string \"quads\"\n");    fprintf(opt1,"attribute \"ref\" string \"positions\"\n");    fprintf(opt1,"#\n");    fprintf(opt1,"object 2 class array type float rank 1 shape 2 items %d data follows\n",(resol_x+1)*(resol_y+1));    for ( i = 0; i<= resol_x; i++) {        i_f = cnt_x*i+begin_row;         for ( j = 0; j<= resol_y; j++) {           j_f=cnt_y*j+begin_col;          /* call kriging subroutine */           fprintf(opt,"%f %f\n",i_f,j_f);           fprintf(opt1,"%f %f\n",i_f,j_f);	   l++;        }    }    fprintf(opt,"#\n");    fprintf(opt1,"#\n");    fprintf(opt,"object 3 class array type float rank 0 items %d data follows\n", (resol_x+1)*(resol_y+1));    fprintf(opt1,"object 3 class array type float rank 0 items %d data follows\n", (resol_x+1)*(resol_y+1));    for ( i = 0; i<= resol_x; i++) {        i_f = cnt_x*i+begin_row;         for ( j = 0; j<= resol_y; j++) {           j_f=cnt_y*j+begin_col;          /* call kriging subroutine */           kriging_result(V,i_f,j_f,dim,pos,Z_s,mode,a,c0,c1);           fprintf(opt,"%f\n",result[0]);           fprintf(opt1,"%f\n",result[1]);        }    }    fprintf(opt,"attribute \"dep\" string \"positions\"\n");    fprintf(opt,"#\n");    fprintf(opt,"object \"default\" class field\n");    fprintf(opt,"component \"connections\" value 1\n");    fprintf(opt,"component \"positions\" value 2\n");    fprintf(opt,"component \"data\" value 3\n");    fprintf(opt,"#\n");    fprintf(opt,"end\n");    fclose(opt);    fprintf(opt1,"attribute \"dep\" string \"positions\"\n");    fprintf(opt1,"#\n");    fprintf(opt1,"object \"default\" class field\n");    fprintf(opt1,"component \"connections\" value 1\n");    fprintf(opt1,"component \"positions\" value 2\n");    fprintf(opt1,"component \"data\" value 3\n");    fprintf(opt1,"#\n");    fprintf(opt1,"end\n");    fclose(opt1);    DXFree(V);    DXFree(D);    DXFree(weight);    return OK;error:    return ERROR;}/*--------- kriging_result subroutine -----------*/float kriging_result(float *V, float i_f, float j_f, int dim, float *pos,        float *Z_s, int mode,int a, float c0, float c1) {    int i,j;    float h;/* caculate the distance between estimated point and sample datas *//* and caculate the variogram of estimated point and sample datas and          put into D array */    for (i=0; i < dim-1 ; i++) {        h = sqrt( ( pos[i*2]-i_f )*( pos[i*2]-i_f ) +                  ( pos[i*2+1]-j_f )*( pos[i*2+1]-j_f ) );        switch( mode ) {            case 1 : /* Spher mode */                     if ( h < a )                        D[i] = c0 + c1 * (1.5*h/a - 0.5*(h/a)*(h/a)*(h/a));                     else                        D[i] = c0 + c1;                     break;            case 2 : /* Expon mode */                     D[i] = c0 + c1 * (1 - exp(-3*h/a));                     break;            case 3 : /* Gauss mode */                     D[i] = c0 + c1 * (1 - exp(-3*h*h/a/a));                     break;            default: fprintf(stderr, " mode error \n");                     break;        }    }    D[i] = 1;    /* caculate the weights */    for ( i = 0 ;i <= dim ;i++) {       weight[i] = 0;       for ( j = 0 ; j <= dim ; j++)          weight[i] += V[i*dim+j] * D[j];    }    /* caculate and return the estimated value */    result[0] = 0;    for ( i = 0 ;i < dim ;i++) {        result[0] += weight[i] * Z_s[i];    }/* result[0] : kriging result *//* result[1] : error variance result */    result[0] = ( result[0] >= 0 ) ? result[0] : 0;    result[1] = 0;    for ( i = 0 ;i < dim-1 ;i++) {        result[1] += weight[i] * D[i];    }    result[1] += weight[dim-1];    result[1] = sqrt(result[1]);    return (1);}/* get the maximum and minimum value of input range as default range */int *get_range(float *pos, int *range, int item) {    float min_row, min_col, max_row, max_col;    int i;        min_row = *pos;    min_col = *(pos+1);    max_row = *pos;    max_col = *(pos+1);            for ( i=2; i<item; i+=2){        if ( min_row > *(pos+i) ) min_row = *(pos+i);        if ( min_col > *(pos+i+1) ) min_col = *(pos+i+1);        if ( max_row < *(pos+i) ) max_row = *(pos+i);                if ( max_col < *(pos+i+1) ) max_col = *(pos+i+1);    }        *range = (int) min_row;    *(range+1) = (int) min_col;    *(range+2) = (int) max_row+1;          *(range+3) = (int) max_col+1;        return ( range );     }   

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本不卡视频在线| 欧美男同性恋视频网站| 91在线丨porny丨国产| 欧美一区二区三区在线电影| 中文字幕国产一区| 蜜臀久久99精品久久久久宅男| 成人不卡免费av| 日韩欧美一级二级| 五月天网站亚洲| 色婷婷综合视频在线观看| 国产日韩欧美精品在线| 欧美bbbbb| 欧美女孩性生活视频| 亚洲国产裸拍裸体视频在线观看乱了 | 精品免费一区二区三区| 一区二区三区毛片| 成人av在线资源网| 久久精品综合网| 精品一区二区三区免费视频| 欧美精品日韩综合在线| 一区二区三区日韩| 91欧美激情一区二区三区成人| 中文字幕不卡在线播放| 国产成人精品一区二区三区四区| 精品国产sm最大网站| 久久精品二区亚洲w码| 制服丝袜亚洲精品中文字幕| 亚欧色一区w666天堂| 欧美日韩一区二区三区不卡 | 亚欧色一区w666天堂| 91久久精品国产91性色tv| 自拍偷拍亚洲激情| 91网站视频在线观看| 自拍偷拍欧美精品| 在线视频一区二区免费| 亚洲自拍偷拍网站| 欧美理论片在线| 男男gaygay亚洲| 精品乱人伦一区二区三区| 久久99久久99| 国产午夜一区二区三区| 成人黄色小视频在线观看| 国产精品色在线| 色八戒一区二区三区| 亚洲国产cao| 日韩欧美www| 成人av动漫在线| 亚洲色图第一区| 欧美军同video69gay| 蜜臀av性久久久久蜜臀av麻豆| 精品久久一区二区三区| 国产精品白丝jk黑袜喷水| 欧美激情在线一区二区| 99re视频这里只有精品| 亚洲一区二区三区四区不卡| 欧美日韩视频在线观看一区二区三区 | 一道本成人在线| 婷婷开心久久网| 久久久美女艺术照精彩视频福利播放| 成人毛片在线观看| 五月综合激情婷婷六月色窝| 精品国产sm最大网站免费看| 9i看片成人免费高清| 亚洲国产美女搞黄色| 精品成人一区二区三区四区| 色综合久久久久久久久| 免费观看在线综合色| 国产精品欧美一级免费| 69成人精品免费视频| 国产精品一区在线| 一区二区三区蜜桃| 久久精品一区蜜桃臀影院| 91麻豆蜜桃一区二区三区| 天堂在线亚洲视频| 中文字幕免费不卡在线| 日韩一区二区三区视频在线观看| 白白色 亚洲乱淫| 免费高清视频精品| 亚洲乱码精品一二三四区日韩在线| 91精品国产一区二区人妖| 成人h精品动漫一区二区三区| 日韩高清一区二区| 一区二区三区四区乱视频| 国产亚洲污的网站| 欧美电影一区二区| 欧洲亚洲精品在线| 91视频一区二区三区| 国产精品影视天天线| 日产欧产美韩系列久久99| 一区二区三区在线免费观看| 欧美国产日韩一二三区| 日韩视频在线观看一区二区| 欧美在线免费播放| 99精品国产视频| 丁香六月综合激情| 加勒比av一区二区| 另类中文字幕网| 日韩电影在线观看网站| 一区二区久久久久| 亚洲三级电影网站| 亚洲婷婷国产精品电影人久久| 精品播放一区二区| 日韩欧美在线综合网| 欧美精品一卡二卡| 欧美精品精品一区| 欧美日韩视频在线一区二区 | 日韩欧美二区三区| 欧美欧美欧美欧美| 欧美日韩一区不卡| 在线欧美一区二区| 一本色道久久综合精品竹菊| 不卡视频在线观看| 国产另类ts人妖一区二区| 免费观看91视频大全| 日韩精品亚洲一区| 青青草原综合久久大伊人精品优势 | 免费一级片91| 日韩电影在线观看一区| 日韩成人午夜电影| 日韩二区在线观看| 奇米色777欧美一区二区| 麻豆成人91精品二区三区| 日本美女一区二区| 九九精品一区二区| 激情小说亚洲一区| 丁香桃色午夜亚洲一区二区三区| 国产精品亚洲а∨天堂免在线| 国产suv精品一区二区6| 高清不卡一二三区| 一本到高清视频免费精品| 欧美偷拍一区二区| 欧美一三区三区四区免费在线看| 日韩欧美亚洲国产另类| 欧美精品一区二区不卡 | 国产精品亚洲第一| av一区二区三区黑人| 色老汉一区二区三区| 欧美日韩你懂的| 亚洲精品在线电影| 中文字幕制服丝袜成人av| 亚洲午夜日本在线观看| 水野朝阳av一区二区三区| 黄一区二区三区| av在线播放成人| 91精品国模一区二区三区| 精品黑人一区二区三区久久| 亚洲国产成人午夜在线一区| 一区二区激情视频| 国内外精品视频| 91在线看国产| 日韩亚洲欧美一区| 国产精品精品国产色婷婷| 香蕉成人啪国产精品视频综合网| 美洲天堂一区二卡三卡四卡视频| 国产剧情一区二区| 在线亚洲一区观看| 久久久久国产一区二区三区四区| 专区另类欧美日韩| 麻豆91在线看| 欧美亚洲免费在线一区| 久久欧美一区二区| 亚洲国产精品久久艾草纯爱| 国产精品88av| 欧美日韩在线直播| 国产精品另类一区| 精品在线亚洲视频| 在线观看亚洲精品视频| 久久免费电影网| 天天色天天操综合| av亚洲精华国产精华| 欧美大片拔萝卜| 亚洲一二三区在线观看| 国产suv一区二区三区88区| 在线成人免费视频| 亚洲综合在线视频| 成人91在线观看| 久久蜜桃av一区精品变态类天堂| 五月婷婷综合激情| 在线观看成人免费视频| 中文字幕欧美激情| 国产一区二区精品久久| 91精品国产丝袜白色高跟鞋| 日韩毛片一二三区| 成人黄页毛片网站| 欧美国产精品一区二区三区| 蜜臀99久久精品久久久久久软件| 日本高清免费不卡视频| 国产精品国产三级国产| 国产精品99久久久久久宅男| 亚洲精品一区二区三区99| 日本中文字幕一区二区有限公司| 91久久线看在观草草青青| 亚洲欧美国产三级| 91年精品国产| 亚洲美女在线一区| av亚洲精华国产精华精华| 伊人开心综合网| 欧美三级电影网站| 午夜视频一区在线观看| 色综合久久88色综合天天免费|