• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sf_histint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sf_histint函数的典型用法代码示例。如果您正苦于以下问题:C++ sf_histint函数的具体用法?C++ sf_histint怎么用?C++ sf_histint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sf_histint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[])
{
    int n1, n2, n3, i3;
    float **pp, **qq;
    sf_file in=NULL, out=NULL;

    sf_init(argc,argv);

    in = sf_input("in");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
    n3 = sf_leftsize(in,2);

    pp = sf_floatalloc2(n1,n2);
    qq = sf_floatalloc2(n1,n2);

    for (i3=0; i3 < n3; i3++) {
	sf_floatread(pp[0],n1*n2,in);
	sf_sobel2(n1,n2,pp,qq);
	sf_floatwrite(qq[0],n1*n2,out);
    }


    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:27,代码来源:Mgrad2.c


示例2: main

int main (int argc, char **argv)
{
    bool verb;                /* verbosity flag */
    bool adj;
    int nt;                   /* number of time samples */
    int nx;                   /* number of offsets */ 
    int nf1, nf2, nf;         /* number of filter size */
    int n3, i3;
    float *x, *y, *filt;      /* input and output */
    sf_file in, out, fil;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");
    fil = sf_input("filt");

    if (!sf_getbool("adj",&adj)) adj=true;
    /* if y, perform adjoint operation */

    if (!sf_getbool ("verb",&verb)) verb=false; /* verbosity flag */

    /* read input file parameters */
    if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&nx)) sf_error("No n2= in input");
    n3 = sf_leftsize(in,2);

    if (!sf_histint(fil,"n1",&nf1)) sf_error("No nf1= in filt");
    if (!sf_histint(fil,"n2",&nf2)) sf_error("No nf2= in filt");
    if (!sf_histint(fil,"n3",&nf)) sf_error("No nf3= in filt");

    if (nt != nf1 || nx != nf2 ) sf_error("Nee n1==nf1 && n2==nf2");

    x = sf_floatalloc (nt*nx);
    y = sf_floatalloc (nt*nx);
    filt = sf_floatalloc (nt*nx*nf);

    for (i3=0; i3 < n3; i3++) {
	if(verb) sf_warning("i=%d of %d",i3+1,n3);

	sf_floatread(filt,nt*nx*nf,fil);

	matching_init(filt,nt,nx,nf);

	if (adj) {
	    sf_floatread(y,nt*nx,in);
	} else { /* modeling */
	    sf_floatread(x,nt*nx,in);
	}
    
	pmatching_lop (adj, false, nt*nx, nt*nx, x, y);
	
	if (adj) {
	    sf_floatwrite(x,nt*nx,out);
	} else { /* modeling */
	    sf_floatwrite(y,nt*nx,out);
	}
    }
    
    exit (0);
}
开发者ID:1014511134,项目名称:src,代码行数:60,代码来源:Mtestmatch.c


示例3: main

int main(int argc, char* argv[])
{
    int nt, nd;
    float dist;
    float **points, *point;
    kd_node tree, near;
    sf_file inp, out;

    sf_init(argc,argv);
    inp = sf_input("in");
    out = sf_output("out");

    if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input");
    if (!sf_histint(inp,"n1",&nd)) sf_error("No n1= in input");
    if (!sf_histint(inp,"n2",&nt)) sf_error("No n2= in input");
    sf_putint(out,"n2",1);

    points = sf_floatalloc2(nd,nt);
    sf_floatread(points[0],nd*nt,inp);

    tree = kd_tree(points,nt,nd);

    point = sf_floatalloc(nd);
    if (!sf_getfloats("point",point,nd)) sf_error("Need point=");
    
    dist = SF_HUGE;
    kd_nearest(tree, point, 0, nd, &near, &dist);

    sf_floatwrite(kd_coord(near),nd,out);

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:32,代码来源:Mkdtree.c


示例4: main

int main(int argc, char* argv[])
{
    int j, k, n, n2, i3, n3, iter, niter;
    float **a, *e, **v, s2;
    sf_file mat, val, eig;

    sf_init(argc,argv);
    mat = sf_input("in");
    val = sf_output("out");

    if (SF_FLOAT != sf_gettype(mat)) sf_error("Need float input");
    if (!sf_histint(mat,"n1",&n)) sf_error("No n1= in input");
    if (!sf_histint(mat,"n2",&n2) || n2 != n) sf_error("Need n1=n2 in input");
    n3 = sf_leftsize(mat,2);

    sf_putint(val,"n2",1);

    if (!sf_getint("niter",&niter)) niter=10;

    a = sf_floatalloc2(n,n);
    e = sf_floatalloc(n);

    if (NULL != sf_getstring("eig")) {
	eig = sf_output("eig"); /* eigenvectors */
	v = sf_floatalloc2(n,n);
	for (j=0; j < n; j++) {
	    for (k=0; k < n; k++) {
		v[j][k] = (j==k)? 1.0:0.0;
	    }
	}
    } else {
	eig = NULL;
	v = NULL;
    }

    jacobi_init(n);

    for (i3=0; i3 < n3; i3++) {
	sf_floatread(a[0],n*n,mat);
	
	for (iter=0; iter < niter; iter++) {
	    s2 = 0.;
	    for (j=0; j < n-1; j++) {
		for (k=j+1; k < n; k++) {
		    s2 += jacobi(a,j,k,v);
		}
	    }
	    sf_warning("iter=%d s2=%g",iter+1,s2);
	}

	for (j=0; j < n; j++) {
	    e[j]=a[j][j];
	}

	sf_floatwrite(e,n, val);
	if (NULL != v) 	sf_floatwrite(v[0],n*n, eig);
    }

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:60,代码来源:Mjacobi.c


示例5: main

int main(int argc, char* argv[])
{
    bool adj, verb;
    int n1, n2, n12, n3, i3, order, ns;
    float *input, *smooth, **slope, eps;
    sf_file in, out, dip;

    sf_init(argc,argv);
    in = sf_input("in");
    dip = sf_input("dip");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
    n3 = sf_leftsize(in,2);
    n12 = n1*n2;

    if (!sf_getbool("verb",&verb)) verb=false;
    /* verbosity flag */

    if (!sf_getint("ns",&ns)) ns=0;
    /* smoothing radius */

    if (!sf_getbool("adj",&adj)) adj=false;
    /* adjoint flag */

    if (!sf_getfloat("eps",&eps)) eps=0.01;
    /* regularization */

    if (!sf_getint("order",&order)) order=1;
    /* accuracy order */	

    input = sf_floatalloc(n12);
    smooth = sf_floatalloc(n12);
    slope = sf_floatalloc2(n1,n2);

    pwsmooth_init(ns, n1, n2, order, eps);

    for (i3=0; i3 < n3; i3++) {
	if (verb) sf_warning("slice %d of %d;",i3+1,n3);

	sf_floatread(input,n12,in);
	sf_floatread(slope[0],n12,dip);

	pwsmooth_set(slope);

	if (adj) {
	    pwsmooth_lop(true,false,n12,n12,smooth,input);
	} else {
	    pwsmooth_lop(false,false,n12,n12,input,smooth);
	}

	sf_floatwrite(smooth,n12,out);
    }
    if (verb) sf_warning(".");

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:58,代码来源:Mpwsmooth.c


示例6: main

int main(int argc, char* argv[])
{
    int n1,n2,n12;
    bool adj;
    float d1,d2,o1,o2,v, *model=NULL, *dat=NULL;
    sf_file in=NULL, out=NULL;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histfloat(in,"d1",&d1)) sf_error("No d1= in input");
    if (!sf_histfloat(in,"o1",&o1)) o1=0.;

    if (!sf_getbool("adj",&adj)) adj=false;
    /* adjoint flag */

    if (adj) {
	if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
	if (!sf_histfloat(in,"d2",&d2)) sf_error("No d2= in input");
	if (!sf_histfloat(in,"o2",&o2)) sf_error("No o2= in input");

	sf_putint(out,"n2",1);
    } else {
	if (!sf_getint("n2",&n2)) n2=20;
	/* number of offsets (if inv=n) */
	if (!sf_getfloat("d2",&d2)) d2=200.;
	/* offset sampling (if inv=n) */
	if (!sf_getfloat("o2",&o2)) o2=0.;
	/* offset origin (if inv=n) */

	sf_putint(out,"n2",n2);
	sf_putfloat(out,"d2",d2);
	sf_putfloat(out,"o2",o2);
    }
    n12 = n1*n2;

    if (!sf_getfloat ("v",&v)) v=1000.;
    /* velocity */

    dat = sf_floatalloc(n12);
    model =  sf_floatalloc(n1);

    imospray_init (1./v, o2,d2, o1,d1, n1,n2);

    if (adj) {
	sf_floatread(dat,n12,in);
	imospray_lop (true,false,n1,n12,model,dat);
	sf_floatwrite(model,n1,out);
    } else {	
	sf_floatread(model,n1,in);
	imospray_lop (false,false,n1,n12,model,dat);
	sf_floatwrite(dat,n12,out);
    }

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:58,代码来源:Mimospray.c


示例7: main

int main(int argc, char* argv[])
{
    int nx, nf, i2, n2, lag, niter;
    bool single, verb;
    float eps;
    sf_complex *xx, *yy, *ff;
    sf_file in, out, filt;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");
    filt = sf_input("filt");

    if (SF_COMPLEX != sf_gettype(in) ||
	SF_COMPLEX != sf_gettype(filt)) sf_error("Need float input");
    if (!sf_histint(in,"n1",&nx)) sf_error("No n1= in input");
    n2 = sf_leftsize(in,1);

    if (!sf_histint(filt,"n1",&nf)) sf_error("No n1= in filtin");

    xx = sf_complexalloc(nx);
    ff = sf_complexalloc(nf);

    if (!sf_getbool("single",&single)) single=true;
    /* single channel or multichannel */

    if (!sf_getint("lag",&lag)) lag=1;
    /* lag for internal convolution */

    yy = sf_complexalloc(nx);

    if (!sf_getfloat("eps",&eps)) eps=1.0f;
    /* regularizion parameter */

    if (!sf_getint("niter",&niter)) niter=100;
    /* number of iterations */

    if (!sf_getbool("verb",&verb)) verb=false;
    /* verbosity flag */

    if (!single) sf_complexread (ff,nf,filt);

    for (i2=0; i2 < n2; i2++) {
        if (single) sf_complexread (ff,nf,filt);
        sf_complexread (xx,nx,in);

	cicai1_init(nf,ff,lag);

	sf_csolver_reg(sf_ccopy_lop,sf_ccgstep,cicai1_lop,nx,nx,nx,yy,xx,niter,eps,"verb",verb,"end");
	sf_ccgstep_close();
	
	sf_complexwrite (yy,nx,out);
    }
    
    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:56,代码来源:Mproj.c


示例8: main

int main(int argc, char* argv[])
{
	int i3, n3, ix, nx, iz, nz;
	int nx2, nz2, scalex, scalez;
	float dx, dz;
	float **a, **b;
	sf_file in, out;

	sf_init(argc, argv);

	in=sf_input("in");
	out=sf_output("out");

	if(!sf_getint("scalex", &scalex)) sf_error("Need scalex=");
	if(!sf_getint("scalez", &scalez)) sf_error("Need scalez=");

	if(!sf_histint(in, "n1", &nz)) sf_error("No n1= in input");
	if(!sf_histfloat(in, "d1", &dz)) sf_error("No d1= in input");
	if(!sf_histint(in, "n2", &nx)) sf_error("No n2= in input");
	if(!sf_histfloat(in, "d2", &dx)) sf_error("No d2= in input");

	nx2=(nx-1)*scalex+1;
	nz2=(nz-1)*scalez+1;
	n3=sf_leftsize(in, 2);

	sf_putint(out, "n1", nz2);
	sf_putfloat(out, "d1", dz/scalez);
	sf_putint(out, "n2", nx2);
	sf_putfloat(out, "d2", dx/scalex);

	a=sf_floatalloc2(nz, nx);
	b=sf_floatalloc2(nz2, nx2);

	for (i3=0; i3<n3; i3++){
		sf_floatread(a[0], nz*nx, in);

#pragma omp parallel for private(ix, iz)
		for(ix=0; ix<nx2; ix++){
			for(iz=0; iz<nz2; iz++){
				b[ix][iz]=0.;
			}
		}

#pragma omp parallel for private(ix, iz)
		for(ix=0; ix<nx; ix++){
			for(iz=0; iz<nz; iz++){
				b[ix*scalex][iz*scalez]=a[ix][iz];
			}
		}

		sf_floatwrite(b[0], nz2*nx2, out);
	}

	exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:55,代码来源:Mpadzero.c


示例9: main

int main (int argc, char *argv[])
{
    int ir, nr, n1,n2, m1, m2, n12, nw, n3;
    float *u1, *u2, *p1, *p2;
    sf_file in, out, ang;
    omni2 ap;

    sf_init(argc,argv);
    in = sf_input ("in");
    ang = sf_input ("dip");
    out = sf_output ("out");

    if (SF_FLOAT != sf_gettype(in) ||
	SF_FLOAT != sf_gettype(ang)) sf_error("Need float type");

    if (!sf_histint(in,"n1",&n1)) sf_error("Need n1= in input");
    if (!sf_histint(in,"n2",&n2)) n2=1;
    n12 = n1*n2;
    nr = sf_leftsize(in,2);
    
    if (!sf_histint(ang,"n1",&m1) || m1 != n1) 
	sf_error("Need n1=%d in dip",n1);
    if (1 != n2 && (!sf_histint(ang,"n2",&m2) || m2 != n2)) 
	sf_error("Need n2=%d in dip",n2);
    if (!sf_histint(ang,"n3",&n3) || 2 != n3)
	sf_error("Need n3=2 in dip");
    
    if (!sf_getint("order",&nw)) nw=1;
    /* accuracy */

    u1 = sf_floatalloc(n12);
    u2 = sf_floatalloc(n12);
    p1 = sf_floatalloc(n12);
    p2 = sf_floatalloc(n12);

    for (ir=0; ir < nr; ir++) {
	/* read dip */

	sf_floatread(p1,n12,ang);
	sf_floatread(p2,n12,ang);
	
	/* read data */
	sf_floatread(u1,n12,in);
		
	ap = opwd2_init (nw,n1,n2,p1,p2);
		
	/* apply */
	opwd21(false, false, ap, u1, u2);
		
	/* write out */
	sf_floatwrite(u2,n12,out);
    }
	        
    exit (0);
}
开发者ID:1014511134,项目名称:src,代码行数:55,代码来源:Mopwd2.c


示例10: main

int main(int argc, char*argv[])
{
	sf_file in, out;
	int nf, n1, n2, n3, m, n;
	int i3;
	float **wav, ****fb;
	char *interp;

	sf_init(argc, argv);

	in  = sf_input("in");
	out = sf_output("out");

	if (SF_FLOAT != sf_gettype(in)) sf_error("Need float type");

	if (!sf_histint(in, "n1", &n1)) sf_error("No n1= in input");
	if (!sf_histint(in, "n2", &n2)) sf_error("No n2= in input");
	n3 = sf_leftsize(in, 2);

	sf_shiftdim2(in,out,2);

	if(!sf_getint("m", &m)) m=1;
	/* b[-m, ... ,n] */
	if(!sf_getint("n", &n)) n=1;
	/* b[-m, ... ,n] */
	if ((interp=sf_getstring("interp"))==NULL) interp="maxflat";
	/* interpolation method: maxflat lagrange bspline */

	nf = m+n+1;

	wav = sf_floatalloc2(n1,n2);
	fb  = sf_floatalloc4(n1, n2, nf, nf);

	sf_putint(out, "n3", nf);
	sf_putint(out, "n4", nf);
	sf_putfloat(out, "o3", 0);
	sf_putfloat(out, "d3", 1);
	sf_putfloat(out, "o4", 0);
	sf_putfloat(out, "d4", 1);


	fbank_init(m, n, interp);


	for(i3=0; i3<n3; i3++)
	{
		sf_floatread(wav[0], n1*n2, in);
		fbank2(n1, n2, wav, fb);
		sf_floatwrite(fb[0][0][0], n1*n2*nf*nf, out);
	}

	fbank_close();
	return 0;
}
开发者ID:1014511134,项目名称:src,代码行数:54,代码来源:Mfbank2.c


示例11: main

int main(int argc, char* argv[])
{
    int nx, nf, ny, i2, n2, lag;
    bool each, trans;
    float *xx, *yy, *ff;
    sf_file in, out, filt;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");
    filt = sf_input("filt");

    if (SF_FLOAT != sf_gettype(in) ||
	SF_FLOAT != sf_gettype(filt)) sf_error("Need float input");
    if (!sf_histint(in,"n1",&nx)) sf_error("No n1= in input");
    n2 = sf_leftsize(in,1);

    if (!sf_histint(filt,"n1",&nf)) sf_error("No n1= in filtin");

    xx = sf_floatalloc(nx);
    ff = sf_floatalloc(nf);

    if (!sf_getbool("trans",&trans)) trans=false;
    /* if y, transient convolution; if n, internal */
    if (!sf_getbool("each",&each)) each=false;
    /* if y, new filter for each trace */
    if (!sf_getint("lag",&lag)) lag=1;
    /* lag for internal convolution */

    ny = trans? (nx+nf-1)*(nx+nf-1): nx;
    yy = sf_floatalloc(ny);
    if (trans){
        sf_putint(out,"n1",nx+nf-1);
        sf_putint(out,"n2",nx+nf-1);
    }

    if (!each) sf_floatread (ff,nf,filt);

    for (i2=0; i2 < n2; i2++) {
        if (each) sf_floatread (ff,nf,filt);
        sf_floatread (xx,nx,in);
        if (trans) {
	    tcai1_ns_init(nf,ff);
	    tcai1_ns_lop (false, false,nx,ny,xx,yy);
	} else {
	    icai1_init(nf,ff,lag);
	    icai1_lop (false, false,nx,ny,xx,yy);
	}
	sf_floatwrite (yy,ny,out);
    }

    exit(0);
}
开发者ID:fernandovr89,项目名称:fvillanu,代码行数:53,代码来源:Mtnsconv.c


示例12: main

int main(int argc,char*argv[])
{
	sf_file in, out;
	int i1, i2, j2, i3, n1, n2, n3, nf;
	float **u1, **u2, sigma, d2;

	sf_init(argc,argv);

	in  = sf_input("in");
	out = sf_output("out");

	n3 = sf_leftsize(in, 2);

	if (!sf_histint(in, "n1", &n1)) sf_error("No n1= in input file");
	if (!sf_histint(in, "n2", &n2)) sf_error("No n2= in input file");

	if (!sf_getfloat("sigma", &sigma)) sigma=1.0;
	/* sigma */
	if (!sf_getint("nf", &nf)) nf=100;
	/* frequency samples [0, 0.5] */

	d2 = SF_PI/(nf-1);

	sf_putint(out, "n2", nf);
	sf_putfloat(out, "d2", 0.5/(nf-1));
	dgauss_init(n1, 1.0/sigma);

	u1 = sf_floatalloc2(n1, n2);
	u2 = sf_floatalloc2(n1, nf);

	for (i3=0; i3<n3; i3++)
	{
		sf_floatread(u1[0], n1*n2, in);
		for(i1=0; i1<n1; i1++)
		{
			for (j2=0; j2<nf; j2++)
			for (i2=0; i2<n2; i2++)
			{
				u2[j2][i1] = u1[i2][i1] * dgauss_val(i2, d2*j2) 
					* powf(0.5/SF_PI, i2);
			}
		}
		sf_floatwrite(u2[0], n1*nf, out);
	}

	free(u1[0]);
	free(u2[0]);
	free(u1);
	free(u2);
	dgauss_close();
	exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:52,代码来源:Mfbgabor.c


示例13: main

int main(int argc, char* argv[])
{
    int n1, is, ns, nf, esize, pad;
    off_t i2, n2;
    char *trace, *zero;
    sf_file in, shift;

    sf_init(argc,argv);
    in = sf_input("in");
    shift = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    n2 = sf_leftsize(in,1);

    if (!sf_histint(in,"esize",&esize)) {
	esize=sf_esize(in);
    } else if (0>=esize) {
	sf_error("cannot handle esize=%d",esize);
    }

    if (!sf_getint("ns",&ns)) sf_error("Need ns=");
    /* number of shifts */

    if (!sf_getint("nf",&nf)) nf = 1;
    /* offset of first shift */

    if ((nf+ns-1) >= n1) sf_error("(nf+ns-1)=%d is too large",nf+ns-1);

    sf_putint(shift,"n2",ns);
    sf_shiftdim(in, shift, 2);

    sf_fileflush(shift,in);
    sf_setform(in,SF_NATIVE);
    sf_setform(shift,SF_NATIVE);

    n1 *= esize;

    trace = sf_charalloc(n1);
    zero = sf_charalloc(n1);
    memset(zero,0,n1);

    for (i2=0; i2 < n2; i2++) {
	sf_charread(trace,n1,in);
	for (is=nf; is <= (nf+ns-1); is++) {
	    pad = is*esize;
	    sf_charwrite(zero,pad,shift);
	    sf_charwrite(trace,n1-pad,shift);
	}
    }

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:52,代码来源:Moshift1.c


示例14: main

int main(int argc, char* argv[]) 
{
    int nt, nx, ntx, n2, n3, next;
    float v0, v1, dt, dx, t0, kur;
    float **data;
    sf_file inp, out;

    sf_init(argc,argv);
    inp = sf_input("in");
    out = sf_output("out");

    if (SF_FLOAT != sf_gettype(inp)) sf_error("Need float input");
    if (!sf_histint(inp,"n1",&nt)) sf_error("No n1= in input");
    if (!sf_histfloat(inp,"d1",&dt)) sf_error("No d1= in input");
    if (!sf_histfloat(inp,"o1",&t0)) t0=0.;  

    if (!sf_histint(inp,"n2",&nx)) sf_error("No n2= in input");
    if (!sf_histfloat(inp,"d2",&dx)) sf_error("No d2= in input");

    ntx = nt*nx;

    if (!sf_getfloat("v0",&v0)) v0=SF_EPS;
    /* initial velocity */

    if (!sf_getfloat("v",&v1)) sf_error("Need v=");
    /* final velocity */

    if (!sf_getint("pad",&n2)) n2=nt; /* padding for stretch */
    if (!sf_getint("pad2",&n3)) n3=2*kiss_fft_next_fast_size((n2+1)/2);
    /* padding for FFT */

    if (!sf_getint("extend",&next)) next=4;
    /* trace extension */

    velcon_init(nt,nx,dt,dx,t0,n2,n3,next);

    data = sf_floatalloc2(nt,nx);

    sf_floatread(data[0],ntx,inp);

    kur = kurtosis(ntx,data[0]);
    sf_warning("kurtosis before: %g",kur);

    velcon(data,v0,v1);

    kur = kurtosis(ntx,data[0]);
    sf_warning("kurtosis after: %g",kur);

    sf_floatwrite(data[0],ntx,out);

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:52,代码来源:Mdiffoc.c


示例15: main

int main (int argc, char* argv[])
{
    int n, n1, n2, i1, i2, iv, nv;
    float dv, vel, v2, k, dk, dt;
    float *t, *d;
    sf_file in, out;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");

    if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input");
    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
    n = n1-1;

    if (!sf_getint("nv",&nv)) sf_error("Need nv=");
    if (!sf_getfloat("vel",&vel)) sf_error("Need vel=");

    v2 = 0.5*vel*vel*SF_SIG(vel);
    dv = v2/(nv-1);

    if (!sf_histfloat(in,"dt",&dt)) sf_error("No dt= in input");
    if (!sf_histfloat(in,"d2",&dk)) sf_error("No dk= in input");
    dk *= 2*SF_PI;

    t = sf_floatalloc(n1);
    d = sf_floatalloc(n);
    tricheb_init(n);

    for (i2=0; i2 < n2; i2++) {
	k = i2*dk;
	k *= k*dt*dv*0.25;

	sf_floatread(t,n1,in);
	tricheb_step(-dv,k);

	for (iv=0; iv < nv; iv++) {
	    tricheb_apply (d,t);
	    tricheb_solve (d,t+1);
	    t[0] = 0.;
	    for (i1=1; i1 < n; i1 +=2) {
		t[0] += t[i1]*SF_SIG(dv) - t[i1+1];
	    }
	}

	sf_floatwrite(t,n1,out);
    }

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:51,代码来源:Mchebvc.c


示例16: sf_escrt3_warnext

static char* sf_escrt3_warnext (sf_file input) {
    int icpu = 0, ncpu = 1, maxlen;
    char *host = sf_gethost ();
    char *ext = NULL;

    if (input) {
        if (!sf_histint (input, "icpu", &icpu)) icpu = 0;
        if (!sf_histint (input, "ncpu", &ncpu)) ncpu = 1;
    }
    maxlen = strlen (host) + 30;
    ext = (char*)malloc (maxlen*sizeof(char));
    snprintf (ext, maxlen, "[%s:%d/%d]", host, icpu + 1, ncpu);
    return ext;
}
开发者ID:1014511134,项目名称:src,代码行数:14,代码来源:Mescrt3.c


示例17: main

int main(int argc, char* argv[])
{
    int n1, n2, n12, nv, inv;
    bool adj, add;
    float *modl, *data, o1,d1,o2,d2, vel,v0;
    sf_file in, out;

    sf_init(argc,argv);
    in = sf_input("in");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
    n12 = n1*n2;

    if (!sf_histfloat(in,"o1",&o1)) o1=0.;
    if (!sf_histfloat(in,"o2",&o2)) o2=0.;

    if (!sf_histfloat(in,"d1",&d1)) sf_error("No d1= in input");
    if (!sf_histfloat(in,"d2",&d2)) sf_error("No d2= in input");

    if (!sf_getfloat("vel",&vel)) vel=0.75;
    /* final velocity */
    if (!sf_getfloat("v0",&v0)) v0=0.;
    /* starting velocity */
    if (!sf_getint("nv",&nv)) nv=n1;
    /* number of steps */

    if (!sf_getbool("adj",&adj)) adj=false;
    /* adjoint flag */
    if (!sf_getbool("add",&add)) add=false;
    /* addition flag */

    if (!sf_getint("inv",&inv)) inv=0;
    /* amplitude type */

    modl = sf_floatalloc(n12);
    data = sf_floatalloc(n12);

    sf_floatread (adj? data: modl,n12,in);

    velcon_init (inv,vel,v0,o1,n1,n2,nv,d1,d2);
    velcon_lop (adj, add, n12, n12, modl, data);

    sf_floatwrite (adj? modl: data,n12,out);

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:48,代码来源:Mvelcon.c


示例18: main

int main(int argc, char* argv[]) 
{
    int wide1,wide2,wide3, wide, shift1, shift2, shift3, i, j, k, i1, n1, i2, n2, i3, n3, i4, n4;
    float ***data, ***signal, ***win;
    sf_file in, out;

    sf_init (argc,argv);
    in = sf_input("in");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) sf_error("No n2= in input");
    if (!sf_histint(in,"n3",&n3)) sf_error("No n3= in input");
    n4 = sf_leftsize(in,3);

    data = sf_floatalloc3(n1,n2,n3);
    signal = sf_floatalloc3(n1,n2,n3);

    if (!sf_getint("wide1",&wide1)) wide1=5;
    if (!sf_getint("wide2",&wide2)) wide2=5;
    if (!sf_getint("wide3",&wide3)) wide3=5;
    /* sliding window width */
    wide = wide1*wide2*wide3;

    win = sf_floatalloc3(wide1,wide2,wide3);

    for (i4=0; i4 < n4; i4++) {
	sf_floatread(data[0][0],n1*n2*n3,in);	
	for (i3=0; i3 < n3; i3++) { shift3 = SF_MAX (0, SF_MIN (n3-wide3, i3-wide3/2));
	    for (i2=0; i2 < n2; i2++) { shift2 = SF_MAX (0, SF_MIN (n2-wide2, i2-wide2/2));
		for (i1=0; i1 < n1; i1++) { shift1 = SF_MAX (0, SF_MIN (n1-wide1, i1-wide1/2));
		    for (i=0; i < wide; i++) {
			for (j=0; j < wide; j++) {
			    for (k=0; k < wide; k++) {
				win[i][j][k] = data[shift3+k][shift2+i][shift1+j];
			    }
			}
		    }
		    signal[i3][i2][i1] = sf_quantile(wide/2,wide,win[0][0]);
		}
	    }
	}
	
	sf_floatwrite(signal[0][0],n1*n2*n3,out);
    }	

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:48,代码来源:Mdespike3.c


示例19: main

int main(int argc, char* argv[])
{
    bool verb;
    int j, k, n, n2, i3, n3, iter, niter;
    sf_complex **a=NULL, *e=NULL;
    float s2;
    sf_file mat=NULL, val=NULL;

    sf_init(argc,argv);
    mat = sf_input("in");
    val = sf_output("out");

    if (SF_COMPLEX != sf_gettype(mat)) sf_error("Need complex input");
    if (!sf_histint(mat,"n1",&n)) sf_error("No n1= in input");
    if (!sf_histint(mat,"n2",&n2) || n2 != n) sf_error("Need n1=n2 in input");
    n3 = sf_leftsize(mat,2);

    sf_putint(val,"n2",1);

    if (!sf_getint("niter",&niter)) niter=10;
    if (!sf_getbool("verb",&verb)) verb=false;

    a = sf_complexalloc2(n,n);
    e = sf_complexalloc(n);
    jacobi2_init(n,verb);

    for (i3=0; i3 < n3; i3++) {
	sf_complexread(a[0],n*n,mat);
	
	for (iter=0; iter < niter; iter++) {
	    s2 = 0.;
	    for (j=0; j < n; j++) {
		for (k=0; k < n; k++) {
		    s2 += jacobi2(a,n,j,k);
		}
	    }
	    sf_warning("iter=%d s2=%g",iter+1,s2);
	}

	for (j=0; j < n; j++) {
	    e[j]=a[j][j];
	}
	
	sf_complexwrite(e,n, val);
    }

    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:48,代码来源:Mjacobi2.c


示例20: main

int main(int argc, char* argv[])
{
    int n1, n2, i2;
    bool adj;
    float *pp, *qq;
    sf_file in=NULL, out=NULL;

    sf_init(argc,argv);

    in = sf_input("in");
    out = sf_output("out");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    n2 = sf_leftsize(in,1);

    pp = sf_floatalloc(n1);
    qq = sf_floatalloc(n1);

    if (!sf_getbool("adj",&adj)) adj=false;
    /* if y, do adjoint integration */

    for (i2=0; i2 < n2; i2++) {
	sf_floatread(pp,n1,in);
	if (adj) {
	    sf_causint_lop (true,false,n1,n1,qq,pp);
	} else {
	    sf_causint_lop (false,false,n1,n1,pp,qq);
	}
	sf_floatwrite(qq,n1,out);
    }


    exit(0);
}
开发者ID:1014511134,项目名称:src,代码行数:34,代码来源:Mcausint.c



注:本文中的sf_histint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sf_iaxa函数代码示例发布时间:2022-05-30
下一篇:
C++ sf_histfloat函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap