当前位置: 首页>>代码示例>>C++>>正文


C++ CHECK_FIXNUM函数代码示例

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


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

示例1: rb_gsl_blas_ztrsm2

static VALUE rb_gsl_blas_ztrsm2(VALUE obj, VALUE s, VALUE u, VALUE ta,
             VALUE d, VALUE a, VALUE aa, VALUE bb)
{
  gsl_matrix_complex *A = NULL, *B = NULL, *Bnew = NULL;
  gsl_complex *pa = NULL;
  CBLAS_SIDE_t Side;
  CBLAS_UPLO_t Uplo;
  CBLAS_TRANSPOSE_t TransA;
  CBLAS_DIAG_t Diag;
  CHECK_FIXNUM(s);  CHECK_FIXNUM(u);  CHECK_FIXNUM(ta);  CHECK_FIXNUM(d);
  CHECK_COMPLEX(a);
  CHECK_MATRIX_COMPLEX(aa);
  CHECK_MATRIX_COMPLEX(bb);
  Side = FIX2INT(s);
  Uplo = FIX2INT(u);
  TransA = FIX2INT(ta);
  Diag = FIX2INT(d);
  Data_Get_Struct(a, gsl_complex, pa);
  Data_Get_Struct(aa, gsl_matrix_complex, A);
  Data_Get_Struct(bb, gsl_matrix_complex, B);
  Bnew = gsl_matrix_complex_alloc(B->size1, B->size2);
  gsl_matrix_complex_memcpy(Bnew, B);
  gsl_blas_ztrsm(Side, Uplo, TransA, Diag, *pa, A, Bnew);
  return Data_Wrap_Struct(cgsl_matrix_complex, 0, gsl_matrix_complex_free, Bnew);
}
开发者ID:rbalint,项目名称:rb-gsl,代码行数:25,代码来源:blas3.c

示例2: rb_gsl_combination_calloc

static VALUE rb_gsl_combination_calloc(VALUE klass, VALUE n, VALUE k)
{
  gsl_combination *c = NULL;
  CHECK_FIXNUM(n);CHECK_FIXNUM(k);
  c = gsl_combination_calloc(FIX2INT(n), FIX2INT(k));
  return Data_Wrap_Struct(klass, 0, gsl_combination_free, c);
}
开发者ID:rbalint,项目名称:rb-gsl,代码行数:7,代码来源:combination.c

示例3: rb_gsl_permutation_swap

static VALUE rb_gsl_permutation_swap(VALUE obj, VALUE i, VALUE j)
{
  gsl_permutation *p = NULL;
  CHECK_FIXNUM(i); CHECK_FIXNUM(j);
  Data_Get_Struct(obj, gsl_permutation, p);
  gsl_permutation_swap(p, FIX2INT(i), FIX2INT(j));
  return obj;
}
开发者ID:davidrichards,项目名称:rb-gsl,代码行数:8,代码来源:permutation.c

示例4: rb_gsl_sf_choose_e

static VALUE rb_gsl_sf_choose_e(VALUE obj, VALUE n, VALUE m)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  CHECK_FIXNUM(n); CHECK_FIXNUM(m);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  gsl_sf_choose_e(FIX2INT(n), FIX2INT(m), rslt);
  return v;
}
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:9,代码来源:sf_gamma.c

示例5: rb_gsl_permutation_set

static VALUE rb_gsl_permutation_set(VALUE obj, VALUE ii, VALUE val)
{
  gsl_permutation *p = NULL;
  CHECK_FIXNUM(ii);
  CHECK_FIXNUM(val);
  Data_Get_Struct(obj, gsl_permutation, p);
  p->data[FIX2INT(ii)] = FIX2INT(val);
  return obj;
}
开发者ID:davidrichards,项目名称:rb-gsl,代码行数:9,代码来源:permutation.c

示例6: rb_gsl_combination_set

static VALUE rb_gsl_combination_set(VALUE obj, VALUE ii, VALUE val)
{
  gsl_combination *c = NULL;
  size_t i;
  CHECK_FIXNUM(ii);
  CHECK_FIXNUM(val);
  Data_Get_Struct(obj, gsl_combination, c);
  i = FIX2INT(ii);
  c->data[i] = FIX2INT(val);
  return obj;
}
开发者ID:rbalint,项目名称:rb-gsl,代码行数:11,代码来源:combination.c

示例7: rb_gsl_sf_lnchoose_e

static VALUE rb_gsl_sf_lnchoose_e(VALUE obj, VALUE n, VALUE m)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  CHECK_FIXNUM(n); CHECK_FIXNUM(m);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_lnchoose_e(FIX2INT(n), FIX2INT(m), rslt);
  return v;
}
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:11,代码来源:sf_gamma.c

示例8: rb_gsl_sf_legendre_Plm_e

static VALUE rb_gsl_sf_legendre_Plm_e(VALUE obj, VALUE l, VALUE m, VALUE x)
{
    gsl_sf_result *rslt = NULL;
    VALUE v;
    int status;
    CHECK_FIXNUM(l);
    CHECK_FIXNUM(m);
    Need_Float(x);
    v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
    status = gsl_sf_legendre_Plm_e(FIX2INT(l), FIX2INT(m), NUM2DBL(x), rslt);
    return rb_ary_new3(2, v, INT2FIX(status));
}
开发者ID:gbence,项目名称:rb-gsl-1,代码行数:12,代码来源:sf_legendre.c

示例9: Lisp_XDrawLine

LispObj *
Lisp_XDrawLine(LispBuiltin *builtin)
/*
 x-draw-line display drawable gc x1 y1 x2 y2
 */
{
    Display *display;
    Drawable drawable;
    GC gc;
    int x1, y1, x2, y2;

    LispObj *odisplay, *odrawable, *ogc, *ox1, *oy1, *ox2, *oy2;

    oy2 = ARGUMENT(6);
    ox2 = ARGUMENT(5);
    oy1 = ARGUMENT(4);
    ox1 = ARGUMENT(3);
    ogc = ARGUMENT(2);
    odrawable = ARGUMENT(1);
    odisplay = ARGUMENT(0);

    if (!CHECKO(odisplay, x11Display_t))
	LispDestroy("%s: cannot convert %s to Display*",
		    STRFUN(builtin), STROBJ(odisplay));
    display = (Display*)(odisplay->data.opaque.data);

    /* XXX correct check when drawing to pixmaps implemented */
    if (!CHECKO(odrawable, x11Window_t))
	LispDestroy("%s: cannot convert %s to Drawable",
		    STRFUN(builtin), STROBJ(odrawable));
    drawable = (Drawable)(odrawable->data.opaque.data);

    if (!CHECKO(ogc, x11GC_t))
	LispDestroy("%s: cannot convert %s to Display*",
		    STRFUN(builtin), STROBJ(ogc));
    gc = (GC)(ogc->data.opaque.data);

    CHECK_FIXNUM(ox1);
    x1 = FIXNUM_VALUE(ox1);

    CHECK_FIXNUM(oy1);
    y1 = FIXNUM_VALUE(oy1);

    CHECK_FIXNUM(ox2);
    x2 = FIXNUM_VALUE(ox2);

    CHECK_FIXNUM(oy2);
    y2 = FIXNUM_VALUE(oy2);

    XDrawLine(display, drawable, gc, x1, y1, x2, y2);

    return (odrawable);
}
开发者ID:aosm,项目名称:X11,代码行数:53,代码来源:x11.c

示例10: get_limit_key_workspace

static int get_limit_key_workspace(int argc, VALUE *argv, int argstart,
                                   size_t *limit, int *key,
                                   gsl_integration_workspace **w)
{
  int flag = 0;
  switch (argc-argstart) {
  case 3:
    CHECK_FIXNUM(argv[argstart]);
    CHECK_FIXNUM(argv[argstart+1]);
    CHECK_WORKSPACE(argv[argstart+2]);
    *limit = FIX2INT(argv[argstart]);
    *key = FIX2INT(argv[argstart+1]);
    Data_Get_Struct(argv[argstart+2], gsl_integration_workspace, *w);
    flag = 0;
    break;
  case 1:
    CHECK_FIXNUM(argv[argstart]);
    *key = FIX2INT(argv[argstart]);
    *limit = LIMIT_DEFAULT;
    *w = gsl_integration_workspace_alloc(*limit);
    flag = 1;
    break;
  case 2:
    if (TYPE(argv[argc-1]) == T_FIXNUM) {
      CHECK_FIXNUM(argv[argc-2]);
      *limit = FIX2INT(argv[argc-2]);
      *key = FIX2INT(argv[argc-1]);
      *w = gsl_integration_workspace_alloc(*limit);
      flag = 1;
    } else {
      CHECK_FIXNUM(argv[argc-2]);
      CHECK_WORKSPACE(argv[argc-1]);
      *key = FIX2INT(argv[argc-2]);
      Data_Get_Struct(argv[argc-1], gsl_integration_workspace, *w);
      *limit = (*w)->limit;
      flag = 0;
    }
    break;
  case 0:
    *key = KEY_DEFAULT;
    *limit = LIMIT_DEFAULT;
    *w = gsl_integration_workspace_alloc(*limit);
    flag = 1;
    break;
  default:
    rb_raise(rb_eArgError, "wrong number of arguments");
    break;
  }
  if (*w == NULL) rb_raise(rb_eRuntimeError, "something wrong with workspace");
  return flag;
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:51,代码来源:integration.c

示例11: rb_gsl_sf_hydrogenicR_e

static VALUE rb_gsl_sf_hydrogenicR_e(VALUE obj, VALUE n, VALUE l, 
				     VALUE Z, VALUE r)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  CHECK_FIXNUM(n); CHECK_FIXNUM(l);
  Need_Float(Z); Need_Float(r);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_hydrogenicR_e(FIX2INT(n), FIX2INT(l),
			    NUM2DBL(Z), NUM2DBL(r), rslt);
  return v;
}
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:14,代码来源:sf_coulomb.c

示例12: rb_gsl_sf_legendre_sphPlm_array

static VALUE rb_gsl_sf_legendre_sphPlm_array(VALUE obj, VALUE lmax, VALUE m, VALUE x)
{
    gsl_vector *v = NULL;
    int size;
    int ll, mm;
    CHECK_FIXNUM(lmax);
    CHECK_FIXNUM(m);
    Need_Float(x);
    ll = FIX2INT(lmax);
    mm = FIX2INT(m);
    size = gsl_sf_legendre_array_size(ll, mm);
    v = gsl_vector_alloc(size);
    gsl_sf_legendre_sphPlm_array(ll, mm, NUM2DBL(x), v->data);
    return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
}
开发者ID:gbence,项目名称:rb-gsl-1,代码行数:15,代码来源:sf_legendre.c

示例13: rb_gsl_fit_wlinear

/* linear fit with weights: y = c0 + c1 x */
static VALUE rb_gsl_fit_wlinear(int argc, VALUE *argv, VALUE obj)
{
  double *ptrx, *ptry, *ptrw;
  double c0, c1, cov00, cov01, cov11, sumsq;
  int status;
  size_t n, stridex, stridey, stridew;
  switch (argc) {
  case 3:
    ptrx = get_vector_ptr(argv[0], &stridex, &n);
    ptrw = get_vector_ptr(argv[1], &stridew, &n);
    ptry = get_vector_ptr(argv[2], &stridey, &n);
    break;
  case 4:   
    CHECK_FIXNUM(argv[3]);
    ptrx = get_vector_ptr(argv[0], &stridex, &n);
    ptrw = get_vector_ptr(argv[1], &stridew, &n);
    ptry = get_vector_ptr(argv[2], &stridey, &n);
    n = FIX2INT(argv[3]);
    break;
  default:
    rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
    break;
  }
  status = gsl_fit_wlinear(ptrx, stridex, ptrw, stridew, ptry, stridey,
			   n,
			   &c0, &c1, &cov00, &cov01, &cov11, &sumsq);
  return rb_ary_new3(7, rb_float_new(c0), rb_float_new(c1), rb_float_new(cov00),
		     rb_float_new(cov01), rb_float_new(cov11), rb_float_new(sumsq),
		     INT2FIX(status));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:31,代码来源:fit.c

示例14: Lisp_XBell

LispObj *
Lisp_XBell(LispBuiltin *builtin)
/*
 x-bell &optional percent
 */
{
    Display *display;
    int percent;

    LispObj *odisplay, *opercent;

    opercent = ARGUMENT(1);
    odisplay = ARGUMENT(0);

    if (!CHECKO(odisplay, x11Display_t))
	LispDestroy("%s: cannot convert %s to Display*",
		    STRFUN(builtin), STROBJ(odisplay));
    display = (Display*)(odisplay->data.opaque.data);

    if (opercent == UNSPEC)
	percent = 0;
    else {
	CHECK_FIXNUM(opercent);
	percent = FIXNUM_VALUE(opercent);
    }

    if (percent < -100 || percent > 100)
	LispDestroy("%s: percent value %d out of range -100 to 100",
		    STRFUN(builtin), percent);

    XBell(display, percent);

    return (odisplay);
}
开发者ID:aosm,项目名称:X11,代码行数:34,代码来源:x11.c

示例15: rb_gsl_fft_halfcomplex_wavetable_new

static VALUE rb_gsl_fft_halfcomplex_wavetable_new(VALUE klass, VALUE n)
{
  CHECK_FIXNUM(n);
  return Data_Wrap_Struct(klass, 0, gsl_fft_halfcomplex_wavetable_free,
			  gsl_fft_halfcomplex_wavetable_alloc(FIX2INT(n)));
  
}
开发者ID:james-barnard,项目名称:gsl,代码行数:7,代码来源:fft.c


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