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

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

?? kriging.c

?? Kriging 插值程序
?? C
字號(hào):
/*                   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 );     }   

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产另类ts人妖一区二区| 777亚洲妇女| 高潮精品一区videoshd| 精品一区二区三区不卡 | 国产综合久久久久久久久久久久| 亚洲成人激情av| 亚洲一区在线视频| 亚洲综合色区另类av| 亚洲精品欧美在线| 一区二区三区影院| 亚洲国产精品一区二区www在线| 亚洲免费在线视频| 一区二区三区四区精品在线视频| 亚洲天堂久久久久久久| 亚洲精选一二三| 亚洲精品国产视频| 亚洲成人激情综合网| 日韩国产精品久久久久久亚洲| 午夜精品久久久久久久久久| 亚洲va欧美va人人爽| 毛片av一区二区| 精品一区二区三区在线观看国产 | 粉嫩嫩av羞羞动漫久久久| 国产不卡免费视频| proumb性欧美在线观看| 91麻豆国产福利精品| 欧美网站大全在线观看| 日韩欧美中文字幕一区| 久久久久久免费毛片精品| 国产精品久久久久三级| 一区二区三区日韩欧美| 日韩精品久久理论片| 激情图片小说一区| aaa欧美大片| 7777精品伊人久久久大香线蕉超级流畅 | 日本二三区不卡| 欧美一级片免费看| 国产亚洲精品久| 亚洲六月丁香色婷婷综合久久 | 99久久国产综合精品女不卡| 91成人免费电影| 精品美女一区二区三区| 中文一区二区在线观看| 亚洲一区二区欧美| 久久福利资源站| 不卡一区二区在线| 欧美电影一区二区| 中文字幕av不卡| 天天av天天翘天天综合网 | 成人精品国产免费网站| 欧美午夜片在线看| 国产亚洲一区字幕| 午夜欧美2019年伦理| 国产精品性做久久久久久| 欧美伊人久久大香线蕉综合69| 亚洲精品在线免费观看视频| 依依成人精品视频| 国产一区二区三区蝌蚪| 在线看国产一区二区| 久久亚洲一级片| 午夜精品福利一区二区三区av| 成人一级视频在线观看| 欧美一区二区三区婷婷月色| 亚洲欧美日韩成人高清在线一区| 久久99久久久久| 在线观看国产一区二区| 国产无遮挡一区二区三区毛片日本| 亚洲国产一二三| 成人亚洲精品久久久久软件| 日韩一区二区三区在线| 亚洲一区二区三区精品在线| 日韩精品一区二区三区中文不卡 | 欧美激情中文字幕一区二区| 天天操天天干天天综合网| 97se亚洲国产综合自在线不卡| 精品国产凹凸成av人导航| 亚洲综合色视频| av欧美精品.com| 久久午夜电影网| 日产国产欧美视频一区精品 | 国产精品久久久久久久裸模| 老汉av免费一区二区三区| 欧美日韩综合在线| 亚洲乱码精品一二三四区日韩在线| 国产精品小仙女| 久久夜色精品一区| 加勒比av一区二区| 日韩精品一区二区三区视频| 日本在线不卡视频一二三区| 欧美性猛片aaaaaaa做受| 中文字幕一区在线| 懂色av一区二区三区免费观看| 欧美成人aa大片| 麻豆精品久久精品色综合| 欧美日韩国产区一| 亚洲va国产天堂va久久en| 欧美在线一二三| 一区二区高清视频在线观看| 91天堂素人约啪| 亚洲欧美影音先锋| 99久久精品免费看国产免费软件| 中文字幕成人网| 成人午夜av电影| 中文字幕不卡在线播放| 大白屁股一区二区视频| 欧美国产欧美综合| 成人国产亚洲欧美成人综合网| 日本一区二区综合亚洲| 国产在线精品免费| 久久精品人人做人人综合| 国产精品一区二区x88av| 国产喂奶挤奶一区二区三区| 国产91精品入口| 国产精品久久久久9999吃药| 成人综合在线观看| 1区2区3区国产精品| 91小视频在线免费看| 一区二区视频免费在线观看| 欧美三级一区二区| 婷婷国产v国产偷v亚洲高清| 日韩一区二区在线观看| 国产资源在线一区| 国产精品你懂的在线| 色婷婷av久久久久久久| 亚洲成在线观看| 日韩欧美精品在线视频| 国产麻豆一精品一av一免费| 国产精品国产三级国产普通话蜜臀| 99久久综合99久久综合网站| 一区二区三区**美女毛片| 欧美美女黄视频| 国产综合色产在线精品| 国产精品国产自产拍高清av王其| 国产精品久久久久一区二区三区 | 久久国产精品99久久人人澡| 精品国产乱码久久久久久牛牛| 国产曰批免费观看久久久| 国产精品欧美久久久久无广告| 色综合久久久久久久久久久| 日韩av一二三| 国产网站一区二区| 精品视频全国免费看| 毛片av一区二区| 中文字幕在线视频一区| 欧美性猛交xxxx乱大交退制版| 麻豆传媒一区二区三区| 日本一区二区电影| 欧美日韩国产影片| 国产精品一区二区三区网站| 亚洲综合激情另类小说区| 精品日韩欧美在线| 一本一道久久a久久精品| 麻豆91免费观看| 日韩一区欧美一区| 日韩欧美国产小视频| www.亚洲在线| 日本美女一区二区三区| 国产精品美日韩| 欧美一区二区久久| 色综合久久综合| 国产乱码精品一区二区三区忘忧草 | 国产日韩一级二级三级| 在线观看免费成人| 国产成人免费在线视频| 天涯成人国产亚洲精品一区av| 国产午夜亚洲精品午夜鲁丝片| 欧美日韩中文国产| 9色porny自拍视频一区二区| 美脚の诱脚舐め脚责91| 亚洲一二三区不卡| 欧美高清在线一区二区| 日韩精品一区二区三区在线 | 亚洲精品国产无套在线观| 久久这里只有精品6| 欧美日韩激情在线| av日韩在线网站| 国产精品亚洲а∨天堂免在线| 日本亚洲最大的色成网站www| 国产精品国产三级国产aⅴ无密码| 欧美一级片免费看| 欧美日韩国产欧美日美国产精品| 不卡在线观看av| 国产精品一级片在线观看| 免费一级欧美片在线观看| 亚洲综合一区二区| 中文字幕一区二区视频| 欧美一区二区三区播放老司机| 色欲综合视频天天天| 国产98色在线|日韩| 激情丁香综合五月| 日本美女一区二区三区视频| 午夜久久久影院| 一区二区三区精密机械公司| 日韩一区日韩二区| 亚洲欧洲一区二区在线播放| 国产日韩亚洲欧美综合| 久久色.com| 欧美成人精品1314www| 日韩欧美一级精品久久| 日韩一级完整毛片|