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

C++ GSL_ERROR_VAL函数代码示例

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

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



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

示例1: gsl_wavelet_workspace_alloc

gsl_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,代码来源:gsl_wavelet__wavelet.c


示例2: gsl_rng_alloc

gsl_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,代码来源:rng.c


示例3: FUNCTION

FUNCTION (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,代码来源:view_source.c


示例4: gsl_histogram2d_set_ranges_uniform

int 
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,代码来源:init2d.c


示例5: gsl_wavelet_alloc

gsl_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,代码来源:gsl_wavelet__wavelet.c


示例6: gsl_rng_clone

gsl_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,代码来源:rng.c


示例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,代码来源:alder_vector_interval.c


示例8: gsl_cheb_alloc

gsl_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,代码来源:init.c


示例9: gsl_ntuple_open

gsl_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,代码来源:ntuple.c


示例10: gsl_histogram2d_calloc_uniform

gsl_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,代码来源:init2d.c


示例11: gsl_qrng_clone

gsl_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,代码来源:qrng.c


示例12: gsl_vector_match_const_subvector

_gsl_vector_match_const_view
gsl_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,代码来源:gsl_vector_match.c


示例13: gsl_monte_plain_alloc

gsl_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,代码来源:plain.c


示例14: gsl_min_fminimizer_alloc

gsl_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,代码来源:fsolver.c


示例15: gsl_permutation_alloc

gsl_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,代码来源:init.c


示例16: gsl_vector_match_const_view_array_with_stride

_gsl_vector_match_const_view
gsl_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,代码来源:gsl_vector_match.c


示例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,代码来源:alder_vector_interval.c


示例18: gsl_vector_match_init

gsl_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,代码来源:gsl_vector_match.c


示例19: gsl_qrng_alloc

gsl_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,代码来源:qrng.c


示例20: gsl_histogram2d_pdf_alloc

gsl_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,代码来源:pdf2d.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GSL_IMAG函数代码示例发布时间:2022-05-30
下一篇:
C++ GSL_ERROR_SELECT_2函数代码示例发布时间: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