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

C++ Need_Float函数代码示例

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

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



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

示例1: rb_gsl_blas_dscal

static VALUE rb_gsl_blas_dscal(int argc, VALUE *argv, VALUE obj)
{
  double a;
  gsl_vector *x = NULL;
  switch (TYPE(obj)) {
  case T_MODULE:
  case T_CLASS:
  case T_OBJECT:
    if (argc != 2) rb_raise(rb_eArgError, "wrong number of arguments (%d for 2)",
			    argc);
    Need_Float(argv[0]);
    CHECK_VECTOR(argv[1]);
    a = RFLOAT_VALUE(argv[0]);
    Data_Get_Struct(argv[1], gsl_vector, x);
    gsl_blas_dscal(a, x);
    return argv[1];
    break;
  default:
    if (argc != 1) rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)",
			    argc);
    Need_Float(argv[0]);
    a = RFLOAT_VALUE(argv[0]);
    Data_Get_Struct(obj, gsl_vector, x);
    gsl_blas_dscal(a, x);
    return obj;
    break;
  }
  return Qnil; /* never reach here */
}
开发者ID:Fudge,项目名称:rb-gsl,代码行数:29,代码来源:blas1.c


示例2: rb_gsl_interp_eval_integ_e

static VALUE rb_gsl_interp_eval_integ_e(VALUE obj, VALUE xxa, VALUE yya, 
					VALUE aa, VALUE bb)
{
  rb_gsl_interp *rgi = NULL;
  double *ptr1 = NULL, *ptr2 = NULL;
  size_t size, stridex, stridey;
  double y, a, b;
  int status;
  Need_Float(aa);
  Need_Float(bb);
  Data_Get_Struct(obj, rb_gsl_interp, rgi);
  ptr1 = get_vector_ptr(xxa, &stridex, &size);
  ptr2 = get_vector_ptr(yya, &stridey, &size);
  a = NUM2DBL(aa);
  b = NUM2DBL(bb);
  status = gsl_interp_eval_integ_e(rgi->p, ptr1, ptr2, a, b, rgi->a, &y);
  switch (status) {
  case GSL_EDOM:
    rb_gsl_error_handler("gsl_interp_eval_integ_e error", __FILE__, __LINE__, status);
    break;
  default:
    return rb_float_new(y);
    break;
  }
  return Qnil;
}
开发者ID:davidrichards,项目名称:rb-gsl,代码行数:26,代码来源:interp.c


示例3: rb_gsl_sf_lngamma_complex_e

static VALUE rb_gsl_sf_lngamma_complex_e(int argc, VALUE *argv, VALUE obj)
{
  gsl_sf_result *lnr, *arg;
  gsl_complex *z;
  double re, im;
  VALUE vlnr, varg;
  int status;
  switch (argc) {
  case 1:
    CHECK_COMPLEX(argv[0]);
    Data_Get_Struct(argv[0], gsl_complex, z);
    re = GSL_REAL(*z);
    im = GSL_IMAG(*z);
    break;
  case 2:
    Need_Float(argv[0]); Need_Float(argv[1]);
    re = NUM2DBL(argv[0]);
    im = NUM2DBL(argv[1]);
  default:
    rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
  }
  vlnr = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, lnr);
  varg = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, arg);
  status = gsl_sf_lngamma_complex_e(re, im, lnr, arg);
  return rb_ary_new3(3, vlnr, varg, INT2FIX(status));
}
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:26,代码来源:sf_gamma.c


示例4: rb_gsl_sf_complex_XXX_e

static VALUE rb_gsl_sf_complex_XXX_e(int argc, VALUE *argv, VALUE obj,
                                     int (*f)(double, double, gsl_sf_result*, gsl_sf_result*))
{
  gsl_sf_result *r1, *r2;
  gsl_complex *z;
  double re, im;
  VALUE v1, v2;
  // local variable "status" declared and set, but never used
  //int status;
  switch (argc) {
  case 1:
    CHECK_COMPLEX(argv[0]);
    Data_Get_Struct(argv[0], gsl_complex, z);
    re = GSL_REAL(*z);
    im = GSL_IMAG(*z);
    break;
  case 2:
    Need_Float(argv[0]); Need_Float(argv[1]);
    re = NUM2DBL(argv[0]);
    im = NUM2DBL(argv[1]);
    break;
  default:
    rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
    break;
  }
  v1 = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, r1);
  v2 = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, r2);
  /*status =*/ (*f)(re, im, r1, r2);
  return rb_ary_new3(2, v1, v2);
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:30,代码来源:sf_trigonometric.c


示例5: rb_gsl_sf_coulomb_wave_FGp_array

static VALUE rb_gsl_sf_coulomb_wave_FGp_array(VALUE obj, VALUE Lmin, VALUE kmax,
					 VALUE eta, VALUE x)
{
  double F_exponent, G_exponent;
  int status;
  size_t size;
  gsl_vector *vf = NULL, *vg = NULL, *vfp = NULL, *vgp = NULL;
  VALUE fary, gary, fpary, gpary;
  CHECK_FIXNUM(kmax);
  Need_Float(Lmin); Need_Float(eta); Need_Float(x);
  size = FIX2INT(kmax);
  vf = gsl_vector_alloc(size);
  vfp = gsl_vector_alloc(size);
  vg = gsl_vector_alloc(size);
  vgp = gsl_vector_alloc(size);

  status = gsl_sf_coulomb_wave_FGp_array(NUM2DBL(Lmin), size, NUM2DBL(eta), 
				     NUM2DBL(x), vf->data, vfp->data, 
				     vg->data, vgp->data,
				     &F_exponent, &G_exponent);
  fary = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vf);
  fpary =Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vfp);
  gary = Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vg);
  gpary =Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, vgp);
  return rb_ary_new3(7, fary, fpary, gary, gpary,
		     rb_float_new(F_exponent), rb_float_new(G_exponent),
		     INT2FIX(status));
}
开发者ID:Zenexer,项目名称:rb-gsl,代码行数:28,代码来源:sf_coulomb.c


示例6: rb_gsl_fit_mul_est

static VALUE rb_gsl_fit_mul_est(int argc, VALUE *argv, VALUE obj)
{
  double y, yerr, x, c1, c11;
  int status;
  switch (argc) {
  case 2:
    Need_Float(argv[0]);
    if (TYPE(argv[1]) == T_ARRAY) {
      c1 = NUM2DBL(rb_ary_entry(argv[1], 0));
      c11 = NUM2DBL(rb_ary_entry(argv[1], 1));
    } else {
      rb_raise(rb_eTypeError, "argv[1]: Array expected");
    }
    x = NUM2DBL(argv[0]);
    break;
  case 3:
    Need_Float(argv[0]); Need_Float(argv[1]); Need_Float(argv[2]);
    x = NUM2DBL(argv[0]);
    c1 = NUM2DBL(argv[1]);
    c11 = NUM2DBL(argv[2]);
    break;
  default:
    rb_raise(rb_eArgError, "wrong number of arguments (%d for 2 or 3)", argc);
    break;
  }
  status = gsl_fit_mul_est(x, c1, c11, &y, &yerr);
  return rb_ary_new3(3, rb_float_new(y), rb_float_new(yerr), INT2FIX(status));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:28,代码来源:fit.c


示例7: rb_gsl_hypot3

static VALUE rb_gsl_hypot3(VALUE obj, VALUE x, VALUE y, VALUE z)
{
  Need_Float(x);
  Need_Float(y);
  Need_Float(z);
  return rb_float_new(gsl_hypot3(NUM2DBL(x), NUM2DBL(y), NUM2DBL(z)));
}
开发者ID:blackwinter,项目名称:rb-gsl,代码行数:7,代码来源:math.c


示例8: rb_gsl_odeiv_control_yp_new

static VALUE rb_gsl_odeiv_control_yp_new(VALUE klass, VALUE epsabs, 
					 VALUE epsrel)
{
  gsl_odeiv_control *c = NULL;
  Need_Float(epsabs); Need_Float(epsrel);
  c = gsl_odeiv_control_yp_new(NUM2DBL(epsabs), NUM2DBL(epsrel));
  return Data_Wrap_Struct(klass, 0, gsl_odeiv_control_free, c);
}
开发者ID:JamesHarrison,项目名称:rb-gsl-1,代码行数:8,代码来源:odeiv.c


示例9: rb_gsl_root_test_delta

static VALUE rb_gsl_root_test_delta(VALUE obj, VALUE xl, VALUE xu, VALUE eabs,
				       VALUE erel)
{
  Need_Float(xl); Need_Float(xu);
  Need_Float(eabs); Need_Float(erel); 
  return INT2FIX(gsl_root_test_delta(NUM2DBL(xl), NUM2DBL(xu),
				     NUM2DBL(eabs), NUM2DBL(erel)));
}
开发者ID:Fudge,项目名称:rb-gsl,代码行数:8,代码来源:root.c


示例10: rb_gsl_fsolver_test_interval

static VALUE rb_gsl_fsolver_test_interval(VALUE obj, VALUE eabs, VALUE erel)
{
  gsl_root_fsolver *s = NULL;
  Need_Float(eabs); Need_Float(erel); 
  Data_Get_Struct(obj, gsl_root_fsolver, s);
  return INT2FIX(gsl_root_test_interval(s->x_lower, s->x_upper,
					NUM2DBL(eabs), NUM2DBL(erel)));
}
开发者ID:Fudge,项目名称:rb-gsl,代码行数:8,代码来源:root.c


示例11: rb_gsl_fminimizer_test_interval

static VALUE rb_gsl_fminimizer_test_interval(VALUE obj, VALUE xl, VALUE xu,
					     VALUE ea, VALUE er)
{
  Need_Float(xl); Need_Float(xu);
  Need_Float(ea); Need_Float(er);
  return INT2FIX(gsl_min_test_interval(NUM2DBL(xl), NUM2DBL(xu),
				       NUM2DBL(ea), NUM2DBL(er)));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:8,代码来源:min.c


示例12: rb_gsl_sf_gegenpoly_array

static VALUE rb_gsl_sf_gegenpoly_array(VALUE obj, VALUE nmax, VALUE lambda, VALUE x)
{
  gsl_vector *v = NULL;
  CHECK_FIXNUM(nmax);
  Need_Float(lambda); Need_Float(x);
  v = gsl_vector_alloc(nmax);
  gsl_sf_gegenpoly_array(FIX2INT(nmax), NUM2DBL(lambda), NUM2DBL(x), v->data);
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:9,代码来源:sf_gegenbauer.c


示例13: make_control_standard

static gsl_odeiv_control* make_control_standard(VALUE epsabs, 
					       VALUE epsrel,
					       VALUE ay, VALUE adydt)
{
  Need_Float(epsabs); Need_Float(epsrel);
  Need_Float(ay);   Need_Float(adydt);
  return gsl_odeiv_control_standard_new(NUM2DBL(epsabs), NUM2DBL(epsrel), 
					NUM2DBL(ay), NUM2DBL(adydt));
}
开发者ID:JamesHarrison,项目名称:rb-gsl-1,代码行数:9,代码来源:odeiv.c


示例14: rb_gsl_sf_elljac_e

static VALUE rb_gsl_sf_elljac_e(VALUE obj, VALUE n, VALUE m)
{
  double sn, cn, dn;
  // local variable "status" declared and set, but never used
  //int status;
  Need_Float(n); Need_Float(m);
  /*status =*/ gsl_sf_elljac_e(NUM2DBL(n), NUM2DBL(m), &sn, &cn, &dn);
  return rb_ary_new3(3, rb_float_new(sn), 
		     rb_float_new(cn), rb_float_new(dn));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:10,代码来源:sf_elljac.c


示例15: rb_gsl_sf_multiply_e

static VALUE rb_gsl_sf_multiply_e(VALUE obj, VALUE x, VALUE y)
{
  gsl_sf_result *r;
  VALUE v;
  int status;
  Need_Float(x); Need_Float(y);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, r);
  status = gsl_sf_multiply_e(NUM2DBL(x), NUM2DBL(y), r);
  return v;
}
开发者ID:Fudge,项目名称:rb-gsl,代码行数:10,代码来源:sf_elementary.c


示例16: rb_gsl_sf_legendre_H3d_array

static VALUE rb_gsl_sf_legendre_H3d_array(VALUE obj, VALUE lmax, VALUE lambda, VALUE eta)
{
    gsl_vector *v = NULL;
    CHECK_FIXNUM(lmax);
    Need_Float(lambda);
    Need_Float(eta);
    v = gsl_vector_alloc(FIX2INT(lmax) + 1);
    gsl_sf_legendre_H3d_array(FIX2INT(lmax), NUM2DBL(lambda), NUM2DBL(eta), v->data);
    return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
}
开发者ID:gbence,项目名称:rb-gsl-1,代码行数:10,代码来源:sf_legendre.c


示例17: rb_gsl_min_fminimizer_test_interval

static VALUE rb_gsl_min_fminimizer_test_interval(VALUE obj, VALUE ea, VALUE er)
{
  gsl_min_fminimizer *gmf = NULL;
  double xl, xu;
  Need_Float(ea); Need_Float(er);
  Data_Get_Struct(obj, gsl_min_fminimizer, gmf);
  xl = gsl_min_fminimizer_x_lower(gmf);
  xu = gsl_min_fminimizer_x_upper(gmf);
  return INT2FIX(gsl_min_test_interval(xl, xu, NUM2DBL(ea), NUM2DBL(er)));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:10,代码来源:min.c


示例18: rb_gsl_sf_lnpoch_sgn_e

static VALUE rb_gsl_sf_lnpoch_sgn_e(VALUE obj, VALUE a, VALUE x)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  double sgn;
  int status;
  Need_Float(a); Need_Float(x);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  status = gsl_sf_lnpoch_sgn_e(NUM2DBL(a), NUM2DBL(x), rslt, &sgn);
  return rb_ary_new3(2, v, rb_float_new(sgn));
}
开发者ID:Fudge,项目名称:rb-gsl,代码行数:11,代码来源:sf_gamma.c


示例19: rb_gsl_min_fminimizer_set

static VALUE rb_gsl_min_fminimizer_set(VALUE obj, VALUE ff, VALUE xmin, 
				       VALUE xl, VALUE xu)
{
  gsl_min_fminimizer *gmf = NULL;
  gsl_function *f = NULL;
  Need_Float(xmin); Need_Float(xl); Need_Float(xu); 
  CHECK_FUNCTION(ff);
  Data_Get_Struct(obj, gsl_min_fminimizer, gmf);
  Data_Get_Struct(ff, gsl_function, f);
  return INT2FIX(gsl_min_fminimizer_set(gmf, f, NUM2DBL(xmin), 
					NUM2DBL(xl), NUM2DBL(xu)));
}
开发者ID:engineyard,项目名称:rb-gsl,代码行数:12,代码来源:min.c


示例20: rb_gsl_sf_cos_err_e

static VALUE rb_gsl_sf_cos_err_e(VALUE obj, VALUE x, VALUE dx)
{
  gsl_sf_result *rslt = NULL;
  VALUE v;
  // local variable "status" declared and set, but never used
  //int status;
  Need_Float(x);
  Need_Float(dx);
  v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt);
  /*status =*/ gsl_sf_cos_err_e(NUM2DBL(x), NUM2DBL(dx), rslt);
  return v;
}
开发者ID:AbhimanyuAryan,项目名称:rb-gsl,代码行数:12,代码来源:sf_trigonometric.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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