这篇教程C++ GSL_ERROR_VAL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GSL_ERROR_VAL函数的典型用法代码示例。如果您正苦于以下问题:C++ GSL_ERROR_VAL函数的具体用法?C++ GSL_ERROR_VAL怎么用?C++ GSL_ERROR_VAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GSL_ERROR_VAL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gsl_wavelet_workspace_allocgsl_wavelet_workspace *gsl_wavelet_workspace_alloc (size_t n){ gsl_wavelet_workspace *work; if (n == 0) { GSL_ERROR_VAL ("length n must be positive integer", GSL_EDOM, 0); } work = (gsl_wavelet_workspace *) malloc (sizeof (gsl_wavelet_workspace)); if (work == NULL) { GSL_ERROR_VAL ("failed to allocate struct", GSL_ENOMEM, 0); } work->n = n; work->scratch = (double *) malloc (n * sizeof (double)); if (work->scratch == NULL) { /* error in constructor, prevent memory leak */ free (work); GSL_ERROR_VAL ("failed to allocate scratch space", GSL_ENOMEM, 0); } return work;}
开发者ID:DsRQuicke,项目名称:praat,代码行数:29,
示例2: gsl_rng_allocgsl_rng *gsl_rng_alloc (const gsl_rng_type * T){ gsl_rng *r = (gsl_rng *) malloc (sizeof (gsl_rng)); if (r == 0) { GSL_ERROR_VAL ("failed to allocate space for rng struct", GSL_ENOMEM, 0); }; r->state = calloc (1, T->size); if (r->state == 0) { free (r); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for rng state", GSL_ENOMEM, 0); }; r->type = T; gsl_rng_set (r, gsl_rng_default_seed); /* seed the generator */ return r;}
开发者ID:MesserLab,项目名称:SLiM,代码行数:28,
示例3: FUNCTIONFUNCTION (gsl_matrix, view_array) (QUALIFIER ATOMIC * array, const size_t n1, const size_t n2){ QUALIFIED_VIEW (_gsl_matrix,view) view = NULL_MATRIX_VIEW; if (n1 == 0) { GSL_ERROR_VAL ("matrix dimension n1 must be positive integer", GSL_EINVAL, view); } else if (n2 == 0) { GSL_ERROR_VAL ("matrix dimension n2 must be positive integer", GSL_EINVAL, view); } { TYPE(gsl_matrix) m = NULL_MATRIX; m.data = (ATOMIC *)array; m.size1 = n1; m.size2 = n2; m.tda = n2; m.block = 0; m.owner = 0; view.matrix = m; return view; }}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:30,
示例4: gsl_histogram2d_set_ranges_uniformint gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, double xmin, double xmax, double ymin, double ymax){ size_t i; const size_t nx = h->nx, ny = h->ny; if (xmin >= xmax) { GSL_ERROR_VAL ("xmin must be less than xmax", GSL_EINVAL, 0); } if (ymin >= ymax) { GSL_ERROR_VAL ("ymin must be less than ymax", GSL_EINVAL, 0); } /* initialize ranges */ make_uniform (h->xrange, nx, xmin, xmax); make_uniform (h->yrange, ny, ymin, ymax); /* clear contents */ for (i = 0; i < nx * ny; i++) { h->bin[i] = 0; } return GSL_SUCCESS;}
开发者ID:lemahdi,项目名称:mglib,代码行数:32,
示例5: gsl_wavelet_allocgsl_wavelet *gsl_wavelet_alloc (const gsl_wavelet_type * T, size_t k){ int status; gsl_wavelet *w = (gsl_wavelet *) malloc (sizeof (gsl_wavelet)); if (w == NULL) { GSL_ERROR_VAL ("failed to allocate space for wavelet struct", GSL_ENOMEM, 0); }; w->type = T; status = (T->init) (&(w->h1), &(w->g1), &(w->h2), &(w->g2), &(w->nc), &(w->offset), k); if (status) { free (w); GSL_ERROR_VAL ("invalid wavelet member", GSL_EINVAL, 0); } return w;}
开发者ID:DsRQuicke,项目名称:praat,代码行数:26,
示例6: gsl_rng_clonegsl_rng *gsl_rng_clone (const gsl_rng * q){ gsl_rng *r = (gsl_rng *) malloc (sizeof (gsl_rng)); if (r == 0) { GSL_ERROR_VAL ("failed to allocate space for rng struct", GSL_ENOMEM, 0); }; r->state = malloc (q->type->size); if (r->state == 0) { free (r); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for rng state", GSL_ENOMEM, 0); }; r->type = q->type; memcpy (r->state, q->state, q->type->size); return r;}
开发者ID:MesserLab,项目名称:SLiM,代码行数:27,
示例7: alder_vector_interval_init/* This function initializes a vector of length n, returning a pointer to a * newly initialized vector struct. A new block is allocated for the elements * of the vector, and stored in the block component of the vector struct. * The size of the vector is set to zero while the size of the block is set * to the argument n. The size of block indicates the capacity of the vector. * Argument: * n - size of the elements * Return: * A point to the vector struct if successful. * A null pointer is returned if insufficient memory is available to * create the vector. */alder_vector_interval_t *alder_vector_interval_init (const size_t n){ alder_vector_interval_block_t * b; alder_vector_interval_t * v; v = (alder_vector_interval_t *) malloc (sizeof (alder_vector_interval_t)); if (v == 0) { GSL_ERROR_VAL ("failed to allocate space for vector struct", GSL_ENOMEM, 0); } b = alder_vector_interval_block_t_alloc (n);; if (b == 0) { free (v) ; GSL_ERROR_VAL ("failed to allocate space for block", GSL_ENOMEM, 0); } v->data = b->data; v->size = 0; v->block = b; return v;}
开发者ID:goshng,项目名称:cocoa,代码行数:41,
示例8: gsl_cheb_allocgsl_cheb_series * gsl_cheb_alloc(const size_t order){ gsl_cheb_series * cs = (gsl_cheb_series *) malloc(sizeof(gsl_cheb_series)); if(cs == 0) { GSL_ERROR_VAL("failed to allocate gsl_cheb_series struct", GSL_ENOMEM, 0); } cs->order = order; cs->order_sp = order; cs->c = (double *) malloc((order+1) * sizeof(double)); if(cs->c == 0) { GSL_ERROR_VAL("failed to allocate cheb coefficients", GSL_ENOMEM, 0); } cs->f = (double *) malloc((order+1) * sizeof(double)); if(cs->f == 0) { GSL_ERROR_VAL("failed to allocate cheb function space", GSL_ENOMEM, 0); } return cs;}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:26,
示例9: gsl_ntuple_opengsl_ntuple *gsl_ntuple_open (char *filename, void *ntuple_data, size_t size){ gsl_ntuple *ntuple = malloc (sizeof (gsl_ntuple)); if (ntuple == 0) { GSL_ERROR_VAL ("failed to allocate space for ntuple struct", GSL_ENOMEM, 0); } ntuple->ntuple_data = ntuple_data; ntuple->size = size; ntuple->file = fopen (filename, "rb"); if (ntuple->file == 0) { free (ntuple); GSL_ERROR_VAL ("unable to open ntuple file for reading", GSL_EFAILED, 0); } return ntuple;}
开发者ID:ICML14MoMCompare,项目名称:spectral-learn,代码行数:25,
示例10: gsl_histogram2d_calloc_uniformgsl_histogram2d *gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny, const double xmin, const double xmax, const double ymin, const double ymax){ gsl_histogram2d *h; if (xmin >= xmax) { GSL_ERROR_VAL ("xmin must be less than xmax", GSL_EINVAL, 0); } if (ymin >= ymax) { GSL_ERROR_VAL ("ymin must be less than ymax", GSL_EINVAL, 0); } h = gsl_histogram2d_calloc (nx, ny); if (h == 0) { return h; } make_uniform (h->xrange, nx, xmin, xmax); make_uniform (h->yrange, ny, ymin, ymax); return h;}
开发者ID:lemahdi,项目名称:mglib,代码行数:29,
示例11: gsl_qrng_clonegsl_qrng *gsl_qrng_clone (const gsl_qrng * q){ gsl_qrng * r = (gsl_qrng *) malloc (sizeof (gsl_qrng)); if (r == 0) { GSL_ERROR_VAL ("failed to allocate space for rng struct", GSL_ENOMEM, 0); }; r->dimension = q->dimension; r->state_size = q->state_size; r->state = malloc (r->state_size); if (r->state == 0) { free (r); GSL_ERROR_VAL ("failed to allocate space for rng state", GSL_ENOMEM, 0); }; r->type = q->type; memcpy (r->state, q->state, q->state_size); return r;}
开发者ID:MubashirHusain,项目名称:parsec-benchmark,代码行数:28,
示例12: gsl_vector_match_const_subvector_gsl_vector_match_const_viewgsl_vector_match_const_subvector (const gsl_vector_match * v, size_t offset, size_t n){ _gsl_vector_match_const_view view = {{0, 0, 0, 0, 0}}; if (n == 0) { GSL_ERROR_VAL ("vector length n must be positive integer", GSL_EINVAL, view); } if (offset + (n - 1) >= v->size) { GSL_ERROR_VAL ("view would extend past end of vector", GSL_EINVAL, view); } { gsl_vector_match s = {0, 0, 0, 0, 0}; s.data = v->data + 1 * v->stride * offset ; s.size = n; s.stride = v->stride; s.block = v->block; s.owner = 0; view.vector = s; return view; }}
开发者ID:goshng,项目名称:cocoa,代码行数:30,
示例13: gsl_monte_plain_allocgsl_monte_plain_state *gsl_monte_plain_alloc (size_t dim){ gsl_monte_plain_state *s = (gsl_monte_plain_state *) malloc (sizeof (gsl_monte_plain_state)); if (s == 0) { GSL_ERROR_VAL ("failed to allocate space for state struct", GSL_ENOMEM, 0); } s->x = (double *) malloc (dim * sizeof (double)); if (s->x == 0) { free (s); GSL_ERROR_VAL ("failed to allocate space for working vector", GSL_ENOMEM, 0); } s->dim = dim; return s;}
开发者ID:ICML14MoMCompare,项目名称:spectral-learn,代码行数:25,
示例14: gsl_min_fminimizer_allocgsl_min_fminimizer *gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) { gsl_min_fminimizer * s = (gsl_min_fminimizer *) malloc (sizeof (gsl_min_fminimizer)); if (s == 0) { GSL_ERROR_VAL ("failed to allocate space for minimizer struct", GSL_ENOMEM, 0); }; s->state = malloc (T->size); if (s->state == 0) { free (s); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for minimizer state", GSL_ENOMEM, 0); }; s->type = T ; s->function = NULL; return s;}
开发者ID:tommyliu,项目名称:visionPJ1,代码行数:27,
示例15: gsl_permutation_allocgsl_permutation *gsl_permutation_alloc (const size_t n){ gsl_permutation * p; if (n == 0) { GSL_ERROR_VAL ("permutation length n must be positive integer", GSL_EDOM, 0); } p = (gsl_permutation *) malloc (sizeof (gsl_permutation)); if (p == 0) { GSL_ERROR_VAL ("failed to allocate space for permutation struct", GSL_ENOMEM, 0); } p->data = (size_t *) malloc (n * sizeof (size_t)); if (p->data == 0) { free (p); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for permutation data", GSL_ENOMEM, 0); } p->size = n; return p;}
开发者ID:lemahdi,项目名称:mglib,代码行数:33,
示例16: gsl_vector_match_const_view_array_with_stride_gsl_vector_match_const_viewgsl_vector_match_const_view_array_with_stride (const gsl_vector_match * base, size_t stride, size_t n){ _gsl_vector_match_const_view view = {{0, 0, 0, 0, 0}}; if (n == 0) { GSL_ERROR_VAL ("vector length n must be positive integer", GSL_EINVAL, view); } if (stride == 0) { GSL_ERROR_VAL ("stride must be positive integer", GSL_EINVAL, view); } { gsl_vector_match v = {0, 0, 0, 0, 0}; v.data = (alder_match_t *)base ; v.size = n; v.stride = stride; v.block = 0; v.owner = 0; view.vector = v; return view; }}
开发者ID:goshng,项目名称:cocoa,代码行数:32,
示例17: alder_vector_interval_block_t_alloc/* This function allocates memory for a block of n elements of * alder_vector_interval_data_t, returning a pointer to the block struct. * The block is not initialized and so the values of its elements are * undefined. Use the function * alder_vector_interval_data_t_calloc if you want to ensure that all the * elements are initialized to zero. * Argument: * n - size of the elements * Return: * A point to the block struct if successful. * A null pointer is returned if insufficient memory is available to * create the block. */alder_vector_interval_block_t *alder_vector_interval_block_t_alloc (const size_t n){ alder_vector_interval_block_t * b; if (n == 0) { GSL_ERROR_VAL ("block length n must be positive integer", GSL_EINVAL, 0); } b = (alder_vector_interval_block_t *) malloc (sizeof (alder_vector_interval_block_t)); if (b == 0) { GSL_ERROR_VAL ("failed to allocate space for block struct", GSL_ENOMEM, 0); } b->data = (alder_vector_interval_data_t *) calloc (1, 1 * n * sizeof (alder_vector_interval_data_t)); if (b->data == 0) { free (b); GSL_ERROR_VAL ("failed to allocate space for block data", GSL_ENOMEM, 0); } b->size = n; return b;}
开发者ID:goshng,项目名称:cocoa,代码行数:45,
示例18: gsl_vector_match_initgsl_vector_match *gsl_vector_match_init (){ gsl_block_match * block; gsl_vector_match * v; v = (gsl_vector_match *) malloc (sizeof (gsl_vector_match)); if (v == 0) { GSL_ERROR_VAL ("failed to allocate space for vector struct", GSL_ENOMEM, 0); } block = gsl_block_match_alloc (GSLVECTORMATCHINITSIZE); if (block == 0) { free (v) ; GSL_ERROR_VAL ("failed to allocate space for block", GSL_ENOMEM, 0); } v->data = block->data ; v->size = 0; v->stride = 1; v->block = block; v->owner = 1; return v;}
开发者ID:goshng,项目名称:cocoa,代码行数:32,
示例19: gsl_qrng_allocgsl_qrng *gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension){ gsl_qrng * q = (gsl_qrng *) malloc (sizeof (gsl_qrng)); if (q == 0) { GSL_ERROR_VAL ("allocation failed for qrng struct", GSL_ENOMEM, 0); }; q->dimension = dimension; q->state_size = T->state_size(dimension); q->state = malloc (q->state_size); if (q->state == 0) { free (q); GSL_ERROR_VAL ("allocation failed for qrng state", GSL_ENOMEM, 0); }; q->type = T; T->init_state(q->state, q->dimension); return q;}
开发者ID:MubashirHusain,项目名称:parsec-benchmark,代码行数:29,
示例20: gsl_histogram2d_pdf_allocgsl_histogram2d_pdf *gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny){ const size_t n = nx * ny; gsl_histogram2d_pdf *p; if (n == 0) { GSL_ERROR_VAL ("histogram2d pdf length n must be positive integer", GSL_EDOM, 0); } p = (gsl_histogram2d_pdf *) malloc (sizeof (gsl_histogram2d_pdf)); if (p == 0) { GSL_ERROR_VAL ("failed to allocate space for histogram2d pdf struct", GSL_ENOMEM, 0); } p->xrange = (double *) malloc ((nx + 1) * sizeof (double)); if (p->xrange == 0) { free (p); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for histogram2d pdf xranges", GSL_ENOMEM, 0); } p->yrange = (double *) malloc ((ny + 1) * sizeof (double)); if (p->yrange == 0) { free (p->xrange); free (p); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for histogram2d pdf yranges", GSL_ENOMEM, 0); } p->sum = (double *) malloc ((n + 1) * sizeof (double)); if (p->sum == 0) { free (p->yrange); free (p->xrange); free (p); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for histogram2d pdf sums", GSL_ENOMEM, 0); } p->nx = nx; p->ny = ny; return p;}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:59,
示例21: gsl_spmatrix_getdoublegsl_spmatrix_get(const gsl_spmatrix *m, const size_t i, const size_t j){ if (i >= m->size1) { GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0.0); } else if (j >= m->size2) { GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0.0); } else { if (GSL_SPMATRIX_ISTRIPLET(m)) { /* traverse binary tree to search for (i,j) element */ void *ptr = tree_find(m, i, j); double x = ptr ? *(double *) ptr : 0.0; return x; } else if (GSL_SPMATRIX_ISCCS(m)) { const size_t *mi = m->i; const size_t *mp = m->p; size_t p; /* loop over column j and search for row index i */ for (p = mp[j]; p < mp[j + 1]; ++p) { if (mi[p] == i) return m->data[p]; } } else if (GSL_SPMATRIX_ISCRS(m)) { const size_t *mi = m->i; const size_t *mp = m->p; size_t p; /* loop over row i and search for column index j */ for (p = mp[i]; p < mp[i + 1]; ++p) { if (mi[p] == j) return m->data[p]; } } else { GSL_ERROR_VAL("unknown sparse matrix type", GSL_EINVAL, 0.0); } /* element not found; return 0 */ return 0.0; }} /* gsl_spmatrix_get() */
开发者ID:atantet,项目名称:gsl,代码行数:56,
示例22: gsl_integration_qawo_table_allocgsl_integration_qawo_table *gsl_integration_qawo_table_alloc (double omega, double L, enum gsl_integration_qawo_enum sine, size_t n){ gsl_integration_qawo_table *t; double * chebmo; if (n == 0) { GSL_ERROR_VAL ("table length n must be positive integer", GSL_EDOM, 0); } t = (gsl_integration_qawo_table *) malloc (sizeof (gsl_integration_qawo_table)); if (t == 0) { GSL_ERROR_VAL ("failed to allocate space for qawo_table struct", GSL_ENOMEM, 0); } chebmo = (double *) malloc (25 * n * sizeof (double)); if (chebmo == 0) { free (t); GSL_ERROR_VAL ("failed to allocate space for chebmo block", GSL_ENOMEM, 0); } t->n = n; t->sine = sine; t->omega = omega; t->L = L; t->par = 0.5 * omega * L; t->chebmo = chebmo; /* precompute the moments */ { size_t i; double scale = 1.0; for (i = 0 ; i < t->n; i++) { compute_moments (t->par * scale, t->chebmo + 25*i); scale *= 0.5; } } return t;}
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:54,
示例23: gsl_sum_levin_utrunc_allocgsl_sum_levin_utrunc_workspace * gsl_sum_levin_utrunc_alloc (size_t n){ gsl_sum_levin_utrunc_workspace * w; if (n == 0) { GSL_ERROR_VAL ("length n must be positive integer", GSL_EDOM, 0); } w = (gsl_sum_levin_utrunc_workspace *) malloc(sizeof(gsl_sum_levin_utrunc_workspace)); if (w == NULL) { GSL_ERROR_VAL ("failed to allocate struct", GSL_ENOMEM, 0); } w->q_num = (double *) malloc (n * sizeof (double)); if (w->q_num == NULL) { free(w) ; /* error in constructor, prevent memory leak */ GSL_ERROR_VAL ("failed to allocate space for q_num", GSL_ENOMEM, 0); } w->q_den = (double *) malloc (n * sizeof (double)); if (w->q_den == NULL) { free (w->q_num); free (w) ; /* error in constructor, prevent memory leak */ GSL_ERROR_VAL ("failed to allocate space for q_den", GSL_ENOMEM, 0); } w->dsum = (double *) malloc (n * sizeof (double)); if (w->dsum == NULL) { free (w->q_den); free (w->q_num); free (w) ; /* error in constructor, prevent memory leak */ GSL_ERROR_VAL ("failed to allocate space for dsum", GSL_ENOMEM, 0); } w->size = n; w->terms_used = 0; w->sum_plain = 0; return w;}
开发者ID:lemahdi,项目名称:mglib,代码行数:53,
示例24: quasi_monte_allocquasi_monte_state* quasi_monte_alloc(size_t dim) { quasi_monte_state* s = (quasi_monte_state*)malloc(sizeof(quasi_monte_state)); if (s == NULL) { GSL_ERROR_VAL("failed to allocate space for quasi_monte_state", GSL_ENOMEM, 0); } s->x = (double*)malloc(dim * sizeof(double)); if (s->x == NULL) { free(s); GSL_ERROR_VAL("failed to allocate space for working vector", GSL_ENOMEM, 0); } s->dim = dim; return s;}
开发者ID:diazona,项目名称:quasimontecarlo,代码行数:13,
示例25: mygsl_histogram3d_getdouble mygsl_histogram3d_get(const mygsl_histogram3d * h, const size_t i, const size_t j, const size_t k){ const size_t nx = h->nx; const size_t ny = h->ny; const size_t nz = h->nz; if (i >= nx) GSL_ERROR_VAL ("index i lies outside valid range of 0 .. nx - 1", GSL_EDOM, 0); if (j >= ny) GSL_ERROR_VAL ("index j lies outside valid range of 0 .. ny - 1", GSL_EDOM, 0); if (k >= nz) GSL_ERROR_VAL ("index k lies outside valid range of 0 .. nz - 1", GSL_EDOM, 0); return h->bin[i*ny*nz + j*nz + k];}
开发者ID:romanbsd,项目名称:rb-gsl,代码行数:14,
示例26: gsl_multimin_fminimizer_allocgsl_multimin_fminimizer *gsl_multimin_fminimizer_alloc (const gsl_multimin_fminimizer_type * T, size_t n){ int status; gsl_multimin_fminimizer *s = (gsl_multimin_fminimizer *) malloc (sizeof (gsl_multimin_fminimizer)); if (s == 0) { GSL_ERROR_VAL ("failed to allocate space for minimizer struct", GSL_ENOMEM, 0); } s->type = T; s->x = gsl_vector_calloc (n); if (s->x == 0) { free (s); GSL_ERROR_VAL ("failed to allocate space for x", GSL_ENOMEM, 0); } s->state = malloc (T->size); if (s->state == 0) { gsl_vector_free (s->x); free (s); GSL_ERROR_VAL ("failed to allocate space for minimizer state", GSL_ENOMEM, 0); } status = (T->alloc) (s->state, n); if (status != GSL_SUCCESS) { free (s->state); gsl_vector_free (s->x); free (s); GSL_ERROR_VAL ("failed to initialize minimizer state", GSL_ENOMEM, 0); } return s;}
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:48,
示例27: gsl_cheb_initint gsl_cheb_init(gsl_cheb_series * cs, const gsl_function *func, const double a, const double b){ size_t k, j; if(a >= b) { GSL_ERROR_VAL("null function interval [a,b]", GSL_EDOM, 0); } cs->a = a; cs->b = b; /* cs->err = 0.0; */ { double bma = 0.5 * (cs->b - cs->a); double bpa = 0.5 * (cs->b + cs->a); double fac = 2.0/(cs->order +1.0); for(k = 0; k<=cs->order; k++) { double y = cos(M_PI * (k+0.5)/(cs->order+1)); cs->f[k] = GSL_FN_EVAL(func, (y*bma + bpa)); } for(j = 0; j<=cs->order; j++) { double sum = 0.0; for(k = 0; k<=cs->order; k++) sum += cs->f[k]*cos(M_PI * j*(k+0.5)/(cs->order+1)); cs->c[j] = fac * sum; } } return GSL_SUCCESS;}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:32,
示例28: gsl_histogram_pdf_sampledoublegsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r){ size_t i; int status;/* Wrap the exclusive top of the bin down to the inclusive bottom of the bin. Since this is a single point it should not affect the distribution. */ if (r == 1.0) { r = 0.0; } status = find (p->n, p->sum, r, &i); if (status) { GSL_ERROR_VAL ("cannot find r in cumulative pdf", GSL_EDOM, 0); } else { double delta = (r - p->sum[i]) / (p->sum[i + 1] - p->sum[i]); double x = p->range[i] + delta * (p->range[i + 1] - p->range[i]); return x; }}
开发者ID:hongjiedai,项目名称:svmheavy.net,代码行数:28,
示例29: FUNCTIONFUNCTION(gsl_matrix, view_array_with_tda) (QUALIFIER ATOMIC * base, const size_t n1, const size_t n2, const size_t tda){ QUALIFIED_VIEW (_gsl_matrix,view) view = NULL_MATRIX_VIEW; if (n2 > tda) { GSL_ERROR_VAL ("matrix dimension n2 must not exceed tda", GSL_EINVAL, view); } { TYPE(gsl_matrix) m = NULL_MATRIX; m.data = (ATOMIC *)base; m.size1 = n1; m.size2 = n2; m.tda = tda; m.block = 0; m.owner = 0; view.matrix = m; return view; }}
开发者ID:BrianGladman,项目名称:gsl,代码行数:27,
示例30: gsl_multiset_allocgsl_multiset *gsl_multiset_alloc (const size_t n, const size_t k){ gsl_multiset * c; if (n == 0) { GSL_ERROR_VAL ("multiset parameter n must be positive integer", GSL_EDOM, 0); } if (k > n) { GSL_ERROR_VAL ("multiset length k must be an integer less than or equal to n", GSL_EDOM, 0); } c = (gsl_multiset *) malloc (sizeof (gsl_multiset)); if (c == 0) { GSL_ERROR_VAL ("failed to allocate space for multiset struct", GSL_ENOMEM, 0); } if (k > 0) { c->data = (size_t *) malloc (k * sizeof (size_t)); if (c->data == 0) { free (c); /* exception in constructor, avoid memory leak */ GSL_ERROR_VAL ("failed to allocate space for multiset data", GSL_ENOMEM, 0); } } else { c->data = 0; } c->n = n; c->k = k; return c;}
开发者ID:CNMAT,项目名称:gsl,代码行数:45,
注:本文中的GSL_ERROR_VAL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GSL_IMAG函数代码示例 C++ GSL_ERROR_SELECT_2函数代码示例 |