这篇教程C++ GSL_ERROR_NULL函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GSL_ERROR_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ GSL_ERROR_NULL函数的具体用法?C++ GSL_ERROR_NULL怎么用?C++ GSL_ERROR_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GSL_ERROR_NULL函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gsl_odeiv_control_allocgsl_odeiv_control *gsl_odeiv_control_alloc(const gsl_odeiv_control_type * T){ gsl_odeiv_control * c = (gsl_odeiv_control *) malloc(sizeof(gsl_odeiv_control)); if(c == 0) { GSL_ERROR_NULL ("failed to allocate space for control struct", GSL_ENOMEM); }; c->type = T; c->state = c->type->alloc(); if (c->state == 0) { free (c); /* exception in constructor, avoid memory leak */ GSL_ERROR_NULL ("failed to allocate space for control state", GSL_ENOMEM); }; return c;}
开发者ID:nchaimov,项目名称:m3l-af,代码行数:25,
示例2: gsl_splinalg_itersolve_allocgsl_splinalg_itersolve *gsl_splinalg_itersolve_alloc(const gsl_splinalg_itersolve_type *T, const size_t n, const size_t m){ gsl_splinalg_itersolve *w; w = calloc(1, sizeof(gsl_splinalg_itersolve)); if (w == NULL) { GSL_ERROR_NULL("failed to allocate space for itersolve struct", GSL_ENOMEM); } w->type = T; w->normr = 0.0; w->state = w->type->alloc(n, m); if (w->state == NULL) { gsl_splinalg_itersolve_free(w); GSL_ERROR_NULL("failed to allocate space for itersolve state", GSL_ENOMEM); } return w;} /* gsl_splinalg_itersolve_alloc() */
开发者ID:BrianGladman,项目名称:gsl,代码行数:26,
示例3: gsl_eigen_gensymm_allocgsl_eigen_gensymm_workspace *gsl_eigen_gensymm_alloc(const size_t n){ gsl_eigen_gensymm_workspace *w; if (n == 0) { GSL_ERROR_NULL ("matrix dimension must be positive integer", GSL_EINVAL); } w = (gsl_eigen_gensymm_workspace *) calloc (1, sizeof (gsl_eigen_gensymm_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->size = n; w->symm_workspace_p = gsl_eigen_symm_alloc(n); if (!w->symm_workspace_p) { gsl_eigen_gensymm_free(w); GSL_ERROR_NULL("failed to allocate space for symm workspace", GSL_ENOMEM); } return (w);} /* gsl_eigen_gensymm_alloc() */
开发者ID:lemahdi,项目名称:mglib,代码行数:29,
示例4: rk2imp_allocstatic void *rk2imp_alloc (size_t dim){ rk2imp_state_t *state = (rk2imp_state_t *) malloc (sizeof (rk2imp_state_t)); if (state == 0) { GSL_ERROR_NULL ("failed to allocate space for rk2imp_state", GSL_ENOMEM); } state->knu = (double *) malloc (dim * sizeof (double)); if (state->knu == 0) { free (state); GSL_ERROR_NULL ("failed to allocate space for knu", GSL_ENOMEM); } state->ytmp = (double *) malloc (dim * sizeof (double)); if (state->ytmp == 0) { free (state->knu); free (state); GSL_ERROR_NULL ("failed to allocate space for ytmp", GSL_ENOMEM); } return state;}
开发者ID:naorbrown,项目名称:EpiFire,代码行数:30,
示例5: gsl_filter_gaussian_allocgsl_filter_gaussian_workspace *gsl_filter_gaussian_alloc(const size_t K){ const size_t H = K / 2; gsl_filter_gaussian_workspace *w; size_t state_size; w = calloc(1, sizeof(gsl_filter_gaussian_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->K = 2 * H + 1; w->kernel = malloc(w->K * sizeof(double)); if (w->kernel == 0) { gsl_filter_gaussian_free(w); GSL_ERROR_NULL ("failed to allocate space for kernel", GSL_ENOMEM); return NULL; } state_size = gaussian_size(w->K); w->movstat_workspace_p = gsl_movstat_alloc_with_size(state_size, H, H); if (!w->movstat_workspace_p) { gsl_filter_gaussian_free(w); GSL_ERROR_NULL ("failed to allocate space for movstat workspace", GSL_ENOMEM); } return w;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:34,
示例6: avl_spmallocstatic void *avl_spmalloc (size_t size, void *param){ gsl_spmatrix *m = (gsl_spmatrix *) param; if (size != sizeof(struct avl_node)) { GSL_ERROR_NULL("attemping to allocate incorrect node size", GSL_EBADLEN); } /* * return the next available avl_node slot; index * m->tree_data->n keeps track of next open slot */ if (m->tree_data->n < m->nzmax) { /* cast to char* for pointer arithmetic */ unsigned char *node_ptr = (unsigned char *) m->tree_data->node_array; /* offset in bytes for next node slot */ size_t offset = (m->tree_data->n)++ * sizeof(struct avl_node); return node_ptr + offset; } else { /* * we should never get here - gsl_spmatrix_realloc() should * be called before exceeding nzmax nodes */ GSL_ERROR_NULL("attemping to allocate tree node past nzmax", GSL_EINVAL); }}
开发者ID:FMX,项目名称:gsl,代码行数:33,
示例7: gsl_odeiv_control_scaled_newgsl_odeiv_control *gsl_odeiv_control_scaled_new(double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs[], size_t dim){ gsl_odeiv_control * c = gsl_odeiv_control_alloc (gsl_odeiv_control_scaled); int status = gsl_odeiv_control_init (c, eps_abs, eps_rel, a_y, a_dydt); if (status != GSL_SUCCESS) { gsl_odeiv_control_free (c); GSL_ERROR_NULL ("error trying to initialize control", status); } { sc_control_state_t * s = (sc_control_state_t *) c->state; s->scale_abs = (double *)malloc(dim * sizeof(double)); if (s->scale_abs == 0) { free (s); GSL_ERROR_NULL ("failed to allocate space for scale_abs", GSL_ENOMEM); } memcpy(s->scale_abs, scale_abs, dim * sizeof(double)); } return c;}
开发者ID:lemahdi,项目名称:mglib,代码行数:34,
示例8: gsl_odeiv2_evolve_allocgsl_odeiv2_evolve *gsl_odeiv2_evolve_alloc (size_t dim){ gsl_odeiv2_evolve *e = (gsl_odeiv2_evolve *) malloc (sizeof (gsl_odeiv2_evolve)); if (e == 0) { GSL_ERROR_NULL ("failed to allocate space for evolve struct", GSL_ENOMEM); } e->y0 = (double *) malloc (dim * sizeof (double)); if (e->y0 == 0) { free (e); GSL_ERROR_NULL ("failed to allocate space for y0", GSL_ENOMEM); } e->yerr = (double *) malloc (dim * sizeof (double)); if (e->yerr == 0) { free (e->y0); free (e); GSL_ERROR_NULL ("failed to allocate space for yerr", GSL_ENOMEM); } e->dydt_in = (double *) malloc (dim * sizeof (double)); if (e->dydt_in == 0) { free (e->yerr); free (e->y0); free (e); GSL_ERROR_NULL ("failed to allocate space for dydt_in", GSL_ENOMEM); } e->dydt_out = (double *) malloc (dim * sizeof (double)); if (e->dydt_out == 0) { free (e->dydt_in); free (e->yerr); free (e->y0); free (e); GSL_ERROR_NULL ("failed to allocate space for dydt_out", GSL_ENOMEM); } e->dimension = dim; e->count = 0; e->failed_steps = 0; e->last_step = 0.0; e->driver = NULL; return e;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:58,
示例9: gsl_spmatrix_ptrdouble *gsl_spmatrix_ptr(gsl_spmatrix *m, const size_t i, const size_t j){ if (i >= m->size1) { GSL_ERROR_NULL("first index out of range", GSL_EINVAL); } else if (j >= m->size2) { GSL_ERROR_NULL("second index out of range", GSL_EINVAL); } else { if (GSL_SPMATRIX_ISTRIPLET(m)) { /* traverse binary tree to search for (i,j) element */ void *ptr = tree_find(m, i, j); return (double *) ptr; } 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 *mj = 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 (mj[p] == j) return &(m->data[p]); } } else { GSL_ERROR_NULL("unknown sparse matrix type", GSL_EINVAL); } /* element not found; return 0 */ return NULL; }} /* gsl_spmatrix_ptr() */
开发者ID:antonio-dibacco,项目名称:gsl-stm32f103,代码行数:54,
示例10: cspline_alloc/* common initialization */static void *cspline_alloc (size_t size){ cspline_state_t * state = (cspline_state_t *) malloc (sizeof (cspline_state_t)); if (state == NULL) { GSL_ERROR_NULL("failed to allocate space for state", GSL_ENOMEM); } state->c = (double *) malloc (size * sizeof (double)); if (state->c == NULL) { free (state); GSL_ERROR_NULL("failed to allocate space for c", GSL_ENOMEM); } state->g = (double *) malloc (size * sizeof (double)); if (state->g == NULL) { free (state->c); free (state); GSL_ERROR_NULL("failed to allocate space for g", GSL_ENOMEM); } state->diag = (double *) malloc (size * sizeof (double)); if (state->diag == NULL) { free (state->g); free (state->c); free (state); GSL_ERROR_NULL("failed to allocate space for diag", GSL_ENOMEM); } state->offdiag = (double *) malloc (size * sizeof (double)); if (state->offdiag == NULL) { free (state->diag); free (state->g); free (state->c); free (state); GSL_ERROR_NULL("failed to allocate space for offdiag", GSL_ENOMEM); } return state;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:51,
示例11: akima_alloc/* common creation */static void *akima_alloc (size_t size){ akima_state_t *state = (akima_state_t *) malloc (sizeof (akima_state_t)); if (state == NULL) { GSL_ERROR_NULL("failed to allocate space for state", GSL_ENOMEM); } state->b = (double *) malloc (size * sizeof (double)); if (state->b == NULL) { free (state); GSL_ERROR_NULL("failed to allocate space for b", GSL_ENOMEM); } state->c = (double *) malloc (size * sizeof (double)); if (state->c == NULL) { free (state->b); free (state); GSL_ERROR_NULL("failed to allocate space for c", GSL_ENOMEM); } state->d = (double *) malloc (size * sizeof (double)); if (state->d == NULL) { free (state->c); free (state->b); free (state); GSL_ERROR_NULL("failed to allocate space for d", GSL_ENOMEM); } state->_m = (double *) malloc ((size + 4) * sizeof (double)); if (state->_m == NULL) { free (state->d); free (state->c); free (state->b); free (state); GSL_ERROR_NULL("failed to allocate space for _m", GSL_ENOMEM); } return state;}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:51,
示例12: gsl_movstat_alloc_with_sizegsl_movstat_workspace *gsl_movstat_alloc_with_size(const size_t accum_state_size, const size_t H, const size_t J){ gsl_movstat_workspace *w; size_t state_size = accum_state_size; w = calloc(1, sizeof(gsl_movstat_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->H = H; w->J = J; w->K = H + J + 1; if (state_size == 0) { /* * determine maximum number of bytes needed for the various accumulators; * the accumulators will all share the same workspace */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_mad->size)(w->K)); /* MAD accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_mean->size)(w->K)); /* mean/variance/sd accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_min->size)(w->K)); /* min/max accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_sum->size)(w->K)); /* sum accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_median->size)(w->K)); /* median accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_Qn->size)(w->K)); /* Q_n accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_qqr->size)(w->K)); /* QQR accumulator */ state_size = GSL_MAX(state_size, (gsl_movstat_accum_Sn->size)(w->K)); /* S_n accumulator */ } w->state = malloc(state_size); if (w->state == 0) { gsl_movstat_free(w); GSL_ERROR_NULL ("failed to allocate space for accumulator state", GSL_ENOMEM); } w->work = malloc(w->K * sizeof(double)); if (w->work == 0) { gsl_movstat_free(w); GSL_ERROR_NULL ("failed to allocate space for work", GSL_ENOMEM); } w->state_size = state_size; return w;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:50,
示例13: gsl_eigen_nonsymm_allocgsl_eigen_nonsymm_workspace *gsl_eigen_nonsymm_alloc(const size_t n){ gsl_eigen_nonsymm_workspace *w; if (n == 0) { GSL_ERROR_NULL ("matrix dimension must be positive integer", GSL_EINVAL); } w = (gsl_eigen_nonsymm_workspace *) calloc (1, sizeof (gsl_eigen_nonsymm_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->size = n; w->Z = NULL; w->do_balance = 0; w->diag = gsl_vector_alloc(n); if (w->diag == 0) { gsl_eigen_nonsymm_free(w); GSL_ERROR_NULL ("failed to allocate space for balancing vector", GSL_ENOMEM); } w->tau = gsl_vector_alloc(n); if (w->tau == 0) { gsl_eigen_nonsymm_free(w); GSL_ERROR_NULL ("failed to allocate space for hessenberg coefficients", GSL_ENOMEM); } w->francis_workspace_p = gsl_eigen_francis_alloc(); if (w->francis_workspace_p == 0) { gsl_eigen_nonsymm_free(w); GSL_ERROR_NULL ("failed to allocate space for francis workspace", GSL_ENOMEM); } return (w);} /* gsl_eigen_nonsymm_alloc() */
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:49,
示例14: gsl_eigen_nonsymmv_allocgsl_eigen_nonsymmv_workspace *gsl_eigen_nonsymmv_alloc(const size_t n){ gsl_eigen_nonsymmv_workspace *w; if (n == 0) { GSL_ERROR_NULL ("matrix dimension must be positive integer", GSL_EINVAL); } w = (gsl_eigen_nonsymmv_workspace *) calloc (1, sizeof (gsl_eigen_nonsymmv_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->size = n; w->Z = NULL; w->nonsymm_workspace_p = gsl_eigen_nonsymm_alloc(n); if (w->nonsymm_workspace_p == 0) { gsl_eigen_nonsymmv_free(w); GSL_ERROR_NULL ("failed to allocate space for nonsymm workspace", GSL_ENOMEM); } /* * set parameters to compute the full Schur form T and balance * the matrices */ gsl_eigen_nonsymm_params(1, 0, w->nonsymm_workspace_p); w->work = gsl_vector_alloc(n); w->work2 = gsl_vector_alloc(n); w->work3 = gsl_vector_alloc(n); if (w->work == 0 || w->work2 == 0 || w->work3 == 0) { gsl_eigen_nonsymmv_free(w); GSL_ERROR_NULL ("failed to allocate space for nonsymmv additional workspace", GSL_ENOMEM); } return (w);} /* gsl_eigen_nonsymmv_alloc() */
开发者ID:lemahdi,项目名称:mglib,代码行数:46,
示例15: gsl_odeiv2_driver_alloc_scaled_newgsl_odeiv2_driver *gsl_odeiv2_driver_alloc_scaled_new (const gsl_odeiv2_system * sys, const gsl_odeiv2_step_type * T, const double hstart, const double epsabs, const double epsrel, const double a_y, const double a_dydt, const double scale_abs[]){ /* Initializes an ODE driver system with control object of type scaled_new. */ gsl_odeiv2_driver *state = driver_alloc (sys, hstart, T); if (state == NULL) { GSL_ERROR_NULL ("failed to allocate driver object", GSL_ENOMEM); } if (epsabs >= 0.0 && epsrel >= 0.0) { state->c = gsl_odeiv2_control_scaled_new (epsabs, epsrel, a_y, a_dydt, scale_abs, sys->dimension); if (state->c == NULL) { gsl_odeiv2_driver_free (state); GSL_ERROR_NULL ("failed to allocate control object", GSL_ENOMEM); } } else { gsl_odeiv2_driver_free (state); GSL_ERROR_NULL ("epsabs and epsrel must be positive", GSL_EINVAL); } /* Distribute pointer to driver object */ gsl_odeiv2_step_set_driver (state->s, state); gsl_odeiv2_evolve_set_driver (state->e, state); gsl_odeiv2_control_set_driver (state->c, state); return state;}
开发者ID:CNMAT,项目名称:gsl,代码行数:44,
示例16: trust_allocstatic void *trust_alloc (const gsl_multilarge_nlinear_parameters * params, const size_t n, const size_t p){ trust_state_t *state; state = calloc(1, sizeof(trust_state_t)); if (state == NULL) { GSL_ERROR_NULL ("failed to allocate lm state", GSL_ENOMEM); } state->diag = gsl_vector_alloc(p); if (state->diag == NULL) { GSL_ERROR_NULL ("failed to allocate space for diag", GSL_ENOMEM); } state->workn = gsl_vector_alloc(n); if (state->workn == NULL) { GSL_ERROR_NULL ("failed to allocate space for workn", GSL_ENOMEM); } state->x_trial = gsl_vector_alloc(p); if (state->x_trial == NULL) { GSL_ERROR_NULL ("failed to allocate space for x_trial", GSL_ENOMEM); } state->f_trial = gsl_vector_alloc(n); if (state->f_trial == NULL) { GSL_ERROR_NULL ("failed to allocate space for f_trial", GSL_ENOMEM); } state->trs_state = (params->trs->alloc)(params, n, p); if (state->trs_state == NULL) { GSL_ERROR_NULL ("failed to allocate space for trs state", GSL_ENOMEM); } if (params->solver != gsl_multilarge_nlinear_solver_none) { state->solver_state = (params->solver->alloc)(n, p); if (state->solver_state == NULL) { GSL_ERROR_NULL ("failed to allocate space for solver state", GSL_ENOMEM); } } state->n = n; state->p = p; state->delta = 0.0; state->params = *params; return state;}
开发者ID:ohliumliu,项目名称:gsl-playground,代码行数:58,
示例17: gsl_spmatrix_ccsgsl_spmatrix *gsl_spmatrix_ccs(const gsl_spmatrix *T){ if (!GSL_SPMATRIX_ISTRIPLET(T)) { GSL_ERROR_NULL("matrix must be in triplet format", GSL_EINVAL); } else { const size_t *Tj; /* column indices of triplet matrix */ size_t *Cp; /* column pointers of compressed column matrix */ size_t *w; /* copy of column pointers */ gsl_spmatrix *m; size_t n; m = gsl_spmatrix_alloc_nzmax(T->size1, T->size2, T->nz, GSL_SPMATRIX_CCS); if (!m) return NULL; Tj = T->p; Cp = m->p; /* initialize column pointers to 0 */ for (n = 0; n < m->size2 + 1; ++n) Cp[n] = 0; /* * compute the number of elements in each column: * Cp[j] = # non-zero elements in column j */ for (n = 0; n < T->nz; ++n) Cp[Tj[n]]++; /* compute column pointers: p[j] = p[j-1] + nnz[j-1] */ gsl_spmatrix_cumsum(m->size2, Cp); /* make a copy of the column pointers */ w = (size_t *) m->work; for (n = 0; n < m->size2; ++n) w[n] = Cp[n]; /* transfer data from triplet format to CCS */ for (n = 0; n < T->nz; ++n) { size_t k = w[Tj[n]]++; m->i[k] = T->i[n]; m->data[k] = T->data[n]; } m->nz = T->nz; return m; }}
开发者ID:antonio-dibacco,项目名称:gsl-stm32f103,代码行数:55,
示例18: dogleg_allocstatic void *dogleg_alloc (const void * params, const size_t n, const size_t p){ const gsl_multifit_nlinear_parameters *mparams = (const gsl_multifit_nlinear_parameters *) params; dogleg_state_t *state; state = calloc(1, sizeof(dogleg_state_t)); if (state == NULL) { GSL_ERROR_NULL ("failed to allocate dogleg state", GSL_ENOMEM); } state->dx_gn = gsl_vector_alloc(p); if (state->dx_gn == NULL) { GSL_ERROR_NULL ("failed to allocate space for dx_gn", GSL_ENOMEM); } state->dx_sd = gsl_vector_alloc(p); if (state->dx_sd == NULL) { GSL_ERROR_NULL ("failed to allocate space for dx_sd", GSL_ENOMEM); } state->workp = gsl_vector_alloc(p); if (state->workp == NULL) { GSL_ERROR_NULL ("failed to allocate space for workp", GSL_ENOMEM); } state->workn = gsl_vector_alloc(n); if (state->workn == NULL) { GSL_ERROR_NULL ("failed to allocate space for workn", GSL_ENOMEM); } state->n = n; state->p = p; state->params = *mparams; return state;}
开发者ID:gaponenko,项目名称:gsl,代码行数:42,
示例19: eulerplus_allocstatic void *eulerplus_alloc (size_t dim){ eulerplus_state_t *state = (eulerplus_state_t *) malloc (sizeof (eulerplus_state_t)); if (state == 0) { GSL_ERROR_NULL ("failed to allocate space for eulerplus_state", GSL_ENOMEM); } state->k1 = (double *) malloc (dim * sizeof (double)); if (state->k1 == 0) { free (state); GSL_ERROR_NULL ("failed to allocate space for k1", GSL_ENOMEM); } state->k2 = (double *) malloc (dim * sizeof (double)); if (state->k2 == 0) { free (state->k1); free (state); GSL_ERROR_NULL ("failed to allocate space for k2", GSL_ENOMEM); } state->ytmp = (double *) malloc (dim * sizeof (double)); if (state->ytmp == 0) { free (state->k2); free (state->k1); free (state); GSL_ERROR_NULL ("failed to allocate space for ytmp", GSL_ENOMEM); } return state;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:42,
示例20: gsl_eigen_herm_allocgsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n){ gsl_eigen_herm_workspace * w ; if (n == 0) { GSL_ERROR_NULL ("matrix dimension must be positive integer", GSL_EINVAL); } w = (gsl_eigen_herm_workspace *) malloc (sizeof(gsl_eigen_herm_workspace)); if (w == 0) { GSL_ERROR_NULL ("failed to allocate space for workspace", GSL_ENOMEM); } w->d = (double *) malloc (n * sizeof (double)); if (w->d == 0) { GSL_ERROR_NULL ("failed to allocate space for diagonal", GSL_ENOMEM); } w->sd = (double *) malloc (n * sizeof (double)); if (w->sd == 0) { GSL_ERROR_NULL ("failed to allocate space for subdiagonal", GSL_ENOMEM); } w->tau = (double *) malloc (2 * n * sizeof (double)); if (w->tau == 0) { GSL_ERROR_NULL ("failed to allocate space for tau", GSL_ENOMEM); } w->size = n; return w;}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:42,
示例21: gsl_spline_allocgsl_spline *gsl_spline_alloc (const gsl_interp_type * T, size_t size){ gsl_spline * spline = (gsl_spline *) malloc (sizeof(gsl_spline)); if (spline == NULL) { GSL_ERROR_NULL ("failed to allocate space for spline struct", GSL_ENOMEM); } spline->interp = gsl_interp_alloc (T, size); if (spline->interp == NULL) { free (spline); GSL_ERROR_NULL ("failed to allocate space for interp", GSL_ENOMEM); }; spline->x = (double *) malloc (size * sizeof(double)); if (spline->x == NULL) { gsl_interp_free(spline->interp); free(spline); GSL_ERROR_NULL ("failed to allocate space for x", GSL_ENOMEM); } spline->y = (double *) malloc (size * sizeof(double)); if (spline->y == NULL) { free(spline->x); gsl_interp_free(spline->interp); free(spline); GSL_ERROR_NULL ("failed to allocate space for y", GSL_ENOMEM); } spline->size = size; return spline;}
开发者ID:ecology-rocks,项目名称:SortieND,代码行数:42,
示例22: euler_allocstatic void *euler_alloc (size_t dim){ euler_state_t *state = (euler_state_t *) malloc (sizeof (euler_state_t)); if (state == 0) { GSL_ERROR_NULL ("failed to allocate space for euler_state", GSL_ENOMEM); } state->k = (double *) malloc (dim * sizeof (double)); if (state->k == 0) { free (state); GSL_ERROR_NULL ("failed to allocate space for k", GSL_ENOMEM); } return state;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:20,
示例23: polynomial_allocstatic void *polynomial_alloc (size_t size){ polynomial_state_t *state = (polynomial_state_t *) malloc (sizeof (polynomial_state_t)); if (state == 0) { GSL_ERROR_NULL ("failed to allocate space for polynomial state", GSL_ENOMEM); } state->d = (double *) malloc (sizeof (double) * size); if (state->d == 0) { free (state); GSL_ERROR_NULL ("failed to allocate space for d", GSL_ENOMEM); } state->coeff = (double *) malloc (sizeof (double) * size); if (state->coeff == 0) { free (state->d); free (state); GSL_ERROR_NULL ("failed to allocate space for d", GSL_ENOMEM); } state->work = (double *) malloc (sizeof (double) * size); if (state->work == 0) { free (state->coeff); free (state->d); free (state); GSL_ERROR_NULL ("failed to allocate space for d", GSL_ENOMEM); } return state;}
开发者ID:mavenlin,项目名称:GSL1.15-Win,代码行数:41,
示例24: gsl_odeiv2_driver_set_hmaxintgsl_odeiv2_driver_set_hmax (gsl_odeiv2_driver * d, const double hmax){ /* Sets maximum allowed step size fabs(hmax) for driver. It is required that hmin <= fabs(h) <= hmax. */ if ((fabs (hmax) < fabs (d->h)) || (fabs (hmax) < d->hmin)) { GSL_ERROR_NULL ("hmin <= fabs(h) <= hmax required", GSL_EINVAL); } if (hmax > 0.0 || hmax < 0.0) { d->hmax = fabs (hmax); } else { GSL_ERROR_NULL ("invalid hmax", GSL_EINVAL); } return GSL_SUCCESS;}
开发者ID:CNMAT,项目名称:gsl,代码行数:22,
示例25: bicubic_allocstatic void *bicubic_alloc(size_t xsize, size_t ysize){ bicubic_state_t *state; state = calloc(1, sizeof (bicubic_state_t)); if (state == NULL) { GSL_ERROR_NULL("failed to allocate space for state", GSL_ENOMEM); } state->zx = (double *) malloc (xsize * ysize * sizeof (double)); if (state->zx == NULL) { bicubic_free(state); GSL_ERROR_NULL("failed to allocate space for zx", GSL_ENOMEM); } state->zy = (double *) malloc (xsize * ysize * sizeof (double)); if (state->zy == NULL) { bicubic_free(state); GSL_ERROR_NULL("failed to allocate space for zy", GSL_ENOMEM); } state->zxy = (double *) malloc (xsize * ysize * sizeof (double)); if (state->zxy == NULL) { bicubic_free(state); GSL_ERROR_NULL("failed to allocate space for zxy", GSL_ENOMEM); } state->xsize = xsize; state->ysize = ysize; return state;} /* bicubic_alloc() */
开发者ID:BrianGladman,项目名称:gsl,代码行数:38,
示例26: gsl_interp_allocgsl_interp *gsl_interp_alloc (const gsl_interp_type * T, size_t size){ gsl_interp * interp; if (size < T->min_size) { GSL_ERROR_NULL ("insufficient number of points for interpolation type", GSL_EINVAL); } interp = (gsl_interp *) malloc (sizeof(gsl_interp)); if (interp == NULL) { GSL_ERROR_NULL ("failed to allocate space for interp struct", GSL_ENOMEM); } interp->type = T; interp->size = size; if (interp->type->alloc == NULL) { interp->state = NULL; return interp; } interp->state = interp->type->alloc(size); if (interp->state == NULL) { free (interp); GSL_ERROR_NULL ("failed to allocate space for interp state", GSL_ENOMEM); }; return interp;}
开发者ID:ICML14MoMCompare,项目名称:spectral-learn,代码行数:38,
示例27: interp2d_allocinterp2d* interp2d_alloc(const interp2d_type* T, size_t xsize, size_t ysize) { interp2d* interp; if (xsize < T->min_size || ysize < T->min_size) { GSL_ERROR_NULL("insufficient number of points for interpolation type", GSL_EINVAL); } interp = (interp2d*)malloc(sizeof(interp2d)); if (interp == NULL) { GSL_ERROR_NULL("failed to allocate space for interp2d struct", GSL_ENOMEM); } interp->type = T; interp->xsize = xsize; interp->ysize = ysize; if (interp->type->alloc == NULL) { interp->state = NULL; return interp; } interp->state = interp->type->alloc(xsize, ysize); if (interp->state == NULL) { free(interp); GSL_ERROR_NULL("failed to allocate space for interp2d state", GSL_ENOMEM); } return interp;}
开发者ID:A2-Collaboration-dev,项目名称:ant,代码行数:23,
示例28: std_control_allocstatic void *std_control_alloc (void){ std_control_state_t *s = (std_control_state_t *) malloc (sizeof (std_control_state_t)); if (s == 0) { GSL_ERROR_NULL ("failed to allocate space for std_control_state", GSL_ENOMEM); } return s;}
开发者ID:VikingDen,项目名称:android_external_Focal,代码行数:14,
示例29: gsl_odeiv2_step_set_driverintgsl_odeiv2_step_set_driver (gsl_odeiv2_step * s, const gsl_odeiv2_driver * d){ if (d != NULL) { s->type->set_driver (s->state, d); } else { GSL_ERROR_NULL ("driver pointer is null", GSL_EFAULT); } return GSL_SUCCESS;}
开发者ID:BrianGladman,项目名称:gsl,代码行数:14,
示例30: rk8pd_allocstatic void *rk8pd_alloc (size_t dim){ rk8pd_state_t *state = (rk8pd_state_t *) malloc (sizeof (rk8pd_state_t)); int i, j; if (state == 0) { GSL_ERROR_NULL ("failed to allocate space for rk8pd_state", GSL_ENOMEM); } state->ytmp = (double *) malloc (dim * sizeof (double)); if (state->ytmp == 0) { free (state); GSL_ERROR_NULL ("failed to allocate space for ytmp", GSL_ENOMEM); } for (i = 0; i < 13; i++) { state->k[i] = (double *) malloc (dim * sizeof (double)); if (state->k[i] == 0) { for (j = 0; j < i; j++) { free (state->k[j]); } free (state->ytmp); free (state); GSL_ERROR_NULL ("failed to allocate space for k's", GSL_ENOMEM); } } return state;}
开发者ID:ICML14MoMCompare,项目名称:spectral-learn,代码行数:37,
注:本文中的GSL_ERROR_NULL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GSL_ERROR_SELECT_2函数代码示例 C++ GSI_UNUSED函数代码示例 |