本文整理汇总了C++中sf_floatalloc2函数的典型用法代码示例。如果您正苦于以下问题:C++ sf_floatalloc2函数的具体用法?C++ sf_floatalloc2怎么用?C++ sf_floatalloc2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sf_floatalloc2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: upgrad_init
upgrad upgrad_init(int mdim /* number of dimensions */,
const int *mm /* [dim] data size */,
const float *d /* [dim] data sampling */)
/*< initialize >*/
{
upgrad upg;
int i;
if (mdim > 3) sf_error("%s: dim=%d > 3",__FILE__,mdim);
ndim = mdim;
nn = mm;
nt = 1;
for (i=0; i < ndim; i++) {
ss[i] = nt;
nt *= nn[i];
dd[i] = 1.0/(d[i]*d[i]);
}
upg = (upgrad) sf_alloc(1,sizeof(*upg));
upg->update = sf_ucharalloc2(2,nt);
upg->wt = sf_floatalloc2(ndim+1,nt);
upg->wx = sf_floatalloc2(ndim+1,nt);
upg->order = sf_intalloc(nt);
return upg;
}
开发者ID:1014511134,项目名称:src,代码行数:29,代码来源:upgradt2d.c
示例2: rgradient_init
void rgradient_init(char* type, int horder, int m1, int m2)
/*< initialize >*/
{
float **p;
int i;
order = horder;
nf = 2*order+1;
c = sf_floatalloc2(nf, 2);
p = lphpoly(order, order, type);
for(i=0; i<2*nf; i++) c[0][i] = p[0][i];
free(p[0]);
free(p);
mode = type[0];
n1 = m1;
n2 = m2;
b1 = sf_floatalloc2(n1, n2);
b2 = sf_floatalloc2(n1, n2);
g = sf_floatalloc3(n1*3, n2, nf);
b = g[0];
memset(g[0][0], 0, n1*n2*nf*sizeof(float));
#ifdef _OPENMP
omp_init();
#endif
}
开发者ID:1014511134,项目名称:src,代码行数:28,代码来源:rgradient.c
示例3: 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
示例4: 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
示例5: eno3_init
eno3 eno3_init (int order /* interpolation order */,
int n1, int n2, int n3 /* data dimensions */)
/*< Initialize interpolation object >*/
{
eno3 pnt;
int i2, i3;
pnt = (eno3) sf_alloc(1,sizeof(*pnt));
pnt->order = order;
pnt->n1 = n1;
pnt->n2 = n2;
pnt->n3 = n3;
pnt->ng = 2*order-2;
if (pnt->ng > n2 || pnt->ng > n3)
sf_error("%s: ng=%d is too big",__FILE__,pnt->ng);
pnt->jnt = sf_eno2_init (order, pnt->ng, pnt->ng);
pnt->f = sf_floatalloc2(pnt->ng,pnt->ng);
pnt->f1 = sf_floatalloc2(pnt->ng,pnt->ng);
pnt->ent = (sf_eno**) sf_alloc(n3,sizeof(sf_eno*));
for (i3 = 0; i3 < n3; i3++) {
pnt->ent[i3] = (sf_eno*) sf_alloc(n2,sizeof(sf_eno));
for (i2 = 0; i2 < n2; i2++) {
pnt->ent[i3][i2] = sf_eno_init (order, n1);
}
}
return pnt;
}
开发者ID:1014511134,项目名称:src,代码行数:28,代码来源:eno3.c
示例6: fbdip_init
void fbdip_init(float rad, int m1, int m2,
int *rect, int niter, float dip0, bool vb)
/*< initialize >*/
{
int n, nn[2];
n1 = m1;
n2 = m2;
verb = vb;
u1 = sf_floatalloc2(n1, n2);
u2 = sf_floatalloc2(n1, n2);
u3 = sf_floatalloc2(n1, n2);
u4 = sf_floatalloc2(n1, n2);
u5 = sf_floatalloc2(n1, n2);
p = sf_complexalloc2(n1, n2);
r=rad;
p0 = rad*cexpf(sf_cmplx(0, dip0));
if(rect[0]>0 && rect[1]>0)
{
n = n1*n2;
nn[0] = n1;
nn[1] = n2;
sf_divn_init (2, n, nn, rect, niter, false);
use_divn=true;
}else use_divn=false;
}
开发者ID:1014511134,项目名称:src,代码行数:28,代码来源:fbdip.c
示例7: inmo_init
void inmo_init(const float* vel /* velocity */,
const float* off /* offset */,
int nh1 /* number of offsets */,
float h0, float dh, int CDPtype, int ix,
int nt1 /* time samples */, bool slow,
float t0, float dt, float eps, bool half,
int jump1 /* subsampling */)
/*< initialization >*/
{
int it, ih;
float f, h, *coord;
const int nw=4;
nh = nh1;
ns = nt1;
jump = jump1;
nt = (ns-1)*jump+1;
dt = dt/jump;
nmo = (map4*) sf_alloc(nh,sizeof(map4));
stretch = sf_floatalloc(nt);
for (ih=0; ih < nh; ih++) {
nmo[ih] = stretch4_init (nt, t0, dt, nt, eps);
h = off[ih] + (dh/CDPtype)*(ix%CDPtype);
if (half) h *= 2;
h = h*h - h0*h0;
for (it=0; it < nt; it++) {
f = t0 + it*dt;
if (slow) {
f = f*f + h*vel[it]*vel[it];
} else {
f = f*f + h/(vel[it]*vel[it]);
}
if (f < 0.) {
stretch[it]=t0-10.*dt;
} else {
stretch[it] = sqrtf(f);
}
}
stretch4_define (nmo[ih],stretch);
}
coord = sf_floatalloc(nt);
for (it=0; it < nt; it++) {
coord[it] = it;
}
spl = sf_spline_init(nw,ns);
sf_int1_init (coord, 0.0, jump, ns, sf_spline_int, nw, nt, 0.0);
free(coord);
dense2 = sf_floatalloc2(nt,nh);
sparse2 = sf_floatalloc2(ns,nh);
}
开发者ID:krushev36,项目名称:src,代码行数:58,代码来源:inmo.c
示例8: main
int main(int argc, char* argv[])
{
int n1, n2,o1,d1,d2,i1,i2,ix,iz;
float ***dat,**sum;
float sum1;
sf_file in, out; /* Input and output files */
/* Initialize RSF */
sf_init(argc,argv);
/* standard input */
in = sf_input("in");
/* standard output */
out = sf_output("out");
/* parameters from input file*/
if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input");
if (!sf_histint(in,"o1",&o1)) sf_error("No o1= in input");
if (!sf_histint(in,"d1",&d1)) sf_error("No d1= in input");
if (!sf_histint(in,"d2",&d2)) sf_error("No d2= in 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");
if (!sf_histint(in,"n3",&n3)) sf_error("No n3= in input");
fprintf(stderr,"values: %d %d\n",n1,n2,n3);
sum = sf_floatalloc2(n3,n3);
dat = sf_floatalloc3 (n1,n2,n3);
fprintf(stderr,"values: %d %d\n",n1,n2);
dat = sf_floatalloc2 (n1,n2);
for (ix=0; ix<n2; ++ix) {
for (iz=0; iz<n1; ++iz) {
dat[ix][iz]=0.0;
}
}
sum1=0;
fprintf(stderr,"values1: %f\n",sum1);
sf_floatread(dat[0],n1*n2,in);
//sum1=0;
fprintf(stderr,"values1: %f\n",sum1);
for (i2=o1; i2<n2; ++i2){
for (i1=o1; i1<n1; ++i1){
sum1 += dat[i2][i1];
}
}
fprintf(stderr,"values: %f\n",sum1);
sum[0][0]=sum1;
sf_floatwrite(sum[0],1*1,out);
exit(0);
}
开发者ID:psava,项目名称:cwp12,代码行数:56,代码来源:sum.c
示例9: 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
示例10: main
int main(int argc, char*argv[])
{
int n1, n2, n3,n4, i2, i3, i4, m2, m3;
sf_file in, hor, out;
float **u, **v, **h, o1, d1;
char *interp;
sinterp intp;
sf_init(argc, argv);
in = sf_input("in");
hor = sf_input("horizon");
out = sf_output("out");
if(!sf_histint(in, "n1", &n1)) sf_error("n1 needed in input");
if(!sf_histfloat(in, "o1", &o1)) o1=0.0;
if(!sf_histfloat(in, "d1", &d1)) d1=1.0;
if(!sf_histint(in, "n2", &n2)) sf_error("n2 needed in input");
if(!sf_histint(in, "n3", &n3)) n3=1;
if(!sf_histint(in, "n4", &n4)) n4=1;
if(!sf_histint(hor, "n1", &m2)) sf_error("n1 needed in horizon file");
if(!sf_histint(hor, "n2", &m3)) m3=1;
if((interp=sf_getstring("interp")) ==NULL ) interp="linear";
/*< interpolation method: nearest, linear >*/
intp = sinterp_c2f(interp);
if(n2!=m2 || n3!= m3) sf_error("horizon file not match");
sf_unshiftdim(in,out,1);
u = sf_floatalloc2(n1, n2);
v = sf_floatalloc2(n2, n3);
h = sf_floatalloc2(n2, n3);
sf_floatread(h[0], n3*n2, hor);
for(i4=0; i4<n4; i4++)
{
for(i3=0; i3<n3; i3++)
{
sf_floatread(u[0], n1*n2, in);
for(i2=0; i2<n2; i2++)
v[i3][i2] = intp(u[i2], (h[i3][i2]-o1)/d1, n1);
}
sf_floatwrite(*v, n2*n3, out);
}
free(*u);
free(u);
free(*v);
free(v);
free(*h);
free(h);
}
开发者ID:1014511134,项目名称:src,代码行数:53,代码来源:Mhorizon.c
示例11: 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
示例12: 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
示例13: stretch4_init
map4 stretch4_init (int n1, float o1, float d1 /* regular axis */,
int nd /* data samples */,
float eps /* regularization */)
/*< initialize >*/
{
int i;
map4 str;
str = (map4) sf_alloc (1, sizeof(*str));
str->nt = n1;
str->t0 = o1;
str->dt = d1;
str->nd = nd;
str->eps = eps;
str->x = sf_intalloc (nd);
str->m = sf_boolalloc (nd);
str->w = sf_floatalloc2 (4,nd);
str->diag = sf_floatalloc (str->nt);
for (i = 0; i < 3; i++) {
str->offd[i] = sf_floatalloc (str->nt-1-i);
}
str->slv = sf_banded_init (str->nt,3);
str->tslv = sf_spline4_init(str->nt);
return str;
}
开发者ID:krushev36,项目名称:src,代码行数:30,代码来源:stretch4.c
示例14: agrid2_init
agrid2 agrid2_init (int order /* interpolation order */,
int n1, int n2 /* data dimensions */,
int nd, int max)
/*< Initialize interpolation object >*/
{
agrid2 pnt;
int i2;
pnt = (agrid2) sf_alloc(1,sizeof(*pnt));
pnt->order = order;
pnt->n1 = n1;
pnt->n2 = n2;
pnt->nd = nd;
pnt->ng = 2*order-2;
if (pnt->ng > pnt->n2) sf_error("ng is too big in agrid2");
pnt->jnt = sf_eno_init (order, pnt->ng);
pnt->f = sf_floatalloc2(pnt->nd,pnt->ng);
pnt->f1 = sf_floatalloc(pnt->ng);
pnt->ent = (agrid*) sf_alloc(n2,sizeof(agrid));
for (i2 = 0; i2 < n2; i2++) {
pnt->ent[i2] = agrid_init (n1, nd, max);
}
return pnt;
}
开发者ID:1014511134,项目名称:src,代码行数:25,代码来源:agrid2.c
示例15: warp3_init
void warp3_init(int n1_in, float o1, float d1,
int n2_in, float o2, float d2,
int n3_in, float o3, float d3 /* output grid */,
int nt, int ny_in, int nx_in /* input grid */,
float eps /* regularization */)
/*< initialize >*/
{
n1 = n1_in;
n2 = n2_in;
n3 = n3_in;
ny = ny_in;
nx = nx_in;
map1 = stretch4_init (n1, o1, d1, nt, eps);
trace1 = sf_floatalloc(n1);
trace2 = sf_floatalloc2(n2,n3);
warp2_init(n2,o2,d2,
n3,o3,d3,
ny,nx,eps);
str2 = sf_floatalloc3(ny,nx,n1);
str3 = sf_floatalloc3(ny,nx,n1);
slice1 = sf_floatalloc3(ny,nx,n1);
}
开发者ID:krushev36,项目名称:src,代码行数:27,代码来源:warp3.c
示例16: tomo2_init
void tomo2_init (float*** rays, int *raylen, int nrays,
float o1, float o2, float d1, float d2,
int n1, int n2,
interpolator interp, int nf_in)
{
int ir, id, i1, i2, nd;
float x1, x2, rx;
nf = nf_in;
m1 = n1;
m2 = n2;
nr = nrays;
rl = raylen;
nxy = (int***) sf_alloc(nr,sizeof(int**));
mask = (bool**) sf_alloc(nr,sizeof(bool*));
w1 = (float***) sf_alloc(nr,sizeof(float**));
w2 = (float***) sf_alloc(nr,sizeof(float**));
for (ir = 0; ir < nr; ir++) {
nd = rl[ir];
nxy[ir] = sf_intalloc2(2,nd);
mask[ir] = sf_boolalloc(nd);
w1[ir] = sf_floatalloc2(nf,nd);
w2[ir] = sf_floatalloc2(nf,nd);
for (id = 0; id < nd; id++) {
rx = (rays[ir][id][0] - o1)/d1;
i1 = (int) floor(rx + 1. - 0.5*nf);
x1 = rx - floor(rx);
rx = (rays[ir][id][1] - o2)/d2;
i2 = (int) floor(rx + 1. - 0.5*nf);
x2 = rx - floor(rx);
if (i1 > - nf && i1 < n1 &&
i2 > - nf && i2 < n2) {
mask[ir][id] = false;
interp (x1, nf, w1[ir][id]);
interp (x2, nf, w2[ir][id]);
nxy[ir][id][0] = i1;
nxy[ir][id][1] = i2;
} else {
mask[ir][id] = true;
}
}
}
}
开发者ID:1014511134,项目名称:src,代码行数:47,代码来源:tomo2.c
示例17: main
int main(int argc, char* argv[])
{
int n1, n2, box1,box2,klo1,khi1,klo2,khi2,kmid1,kmid2;
float **dat,**nsum,**neg,sumA;
sf_file in, out; /* Input and output files */
/* Initialize RSF */
sf_init(argc,argv);
/* standard input */
in = sf_input("in");
/* standard output */
out = sf_output("out");
/* check that the input is float */
if (SF_FLOAT != sf_gettype(in))
sf_error("Need float input");
/* n1 is the fastest dimension (trace length) */
if (!sf_histint(in,"n1",&n1))
sf_error("No n1= in input");
/* leftsize gets n2*n3*n4*... (the number of traces) */
n2 = sf_leftsize(in,1);
/* parameter from the command line (i.e. box1=50 box2=50 ) */
if (!sf_getfloat("box1",&box1)) sf_error("Need box1=");
if (!sf_getfloat("box2",&box2)) sf_error("Nedd box2=");
/* allocate floating point array */
dat= sf_floatalloc2 (n1,n2);
/* initialise the size of the searching box*/
klo1=0;
khi1=box1;
klo2=0;
khi2=box2;
for (int klo1=0, int khi1=box1; khi1<=xmax; ++klo1,++khi1)
/* loop over traces */
for (i2=0; i2 < n2; i2++) {
/* read a trace */
sf_floatread(trace,n1,in);
/* loop over samples */
for (i1=0; i1 < n1; i1++) {
if (trace[i1] > clip) trace[i1]= clip;
else if (trace[i1] < -clip) trace[i1]=-clip;
}
/* write a trace */
sf_floatwrite(trace,n1,out);
}
exit(0);
}
开发者ID:psava,项目名称:cwp12,代码行数:59,代码来源:negentrophy.c
示例18: fft2_init
int fft2_init(bool cmplx1 /* if complex transform */,
int pad1 /* padding on the first axis */,
int nx, int ny /* input data size */,
int *nx2, int *ny2 /* padded data size */)
/*< initialize >*/
{
#ifndef SF_HAS_FFTW
int i2;
#endif
cmplx = cmplx1;
if (cmplx) {
nk = n1 = kiss_fft_next_fast_size(nx*pad1);
#ifndef SF_HAS_FFTW
cfg1 = kiss_fft_alloc(n1,0,NULL,NULL);
icfg1 = kiss_fft_alloc(n1,1,NULL,NULL);
#endif
} else {
nk = kiss_fft_next_fast_size(pad1*(nx+1)/2)+1;
n1 = 2*(nk-1);
#ifndef SF_HAS_FFTW
cfg = kiss_fftr_alloc(n1,0,NULL,NULL);
icfg = kiss_fftr_alloc(n1,1,NULL,NULL);
#endif
}
n2 = kiss_fft_next_fast_size(ny);
if (cmplx) {
cc = sf_complexalloc2(n1,n2);
} else {
ff = sf_floatalloc2(n1,n2);
}
#ifndef SF_HAS_FFTW
cfg2 = kiss_fft_alloc(n2,0,NULL,NULL);
icfg2 = kiss_fft_alloc(n2,1,NULL,NULL);
tmp = (kiss_fft_cpx **) sf_alloc(n2,sizeof(*tmp));
tmp[0] = (kiss_fft_cpx *) sf_alloc(nk*n2,sizeof(kiss_fft_cpx));
for (i2=0; i2 < n2; i2++) {
tmp[i2] = tmp[0]+i2*nk;
}
trace2 = sf_complexalloc(n2);
ctrace2 = (kiss_fft_cpx *) trace2;
#endif
*nx2 = n1;
*ny2 = n2;
wt = 1.0/(n1*n2);
return (nk*n2);
}
开发者ID:krushev36,项目名称:src,代码行数:58,代码来源:fft2.c
示例19: 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
示例20: offgrid_init
/*------------------------------------------------------------*/
ofg2d offgrid_init(fdm2d fdm)
/*< init off-grid interpolation >*/
{
ofg2d ofg;
ofg = (ofg2d) sf_alloc(1,sizeof(*ofg));
ofg->tt = sf_floatalloc2(fdm->nzpad,fdm->nxpad);
return ofg;
}
开发者ID:1014511134,项目名称:src,代码行数:11,代码来源:fdutil.c
注:本文中的sf_floatalloc2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论