File: sf_zeta.c

package info (click to toggle)
ruby-gsl 2.1.0.3%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,604 kB
  • sloc: ansic: 62,050; ruby: 15,845; sh: 19; makefile: 10
file content (115 lines) | stat: -rw-r--r-- 3,278 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
  sf_zeta.c
  Ruby/GSL: Ruby extension library for GSL (GNU Scientific Library)
    (C) Copyright 2001-2006 by Yoshiki Tsunesada

  Ruby/GSL is free software: you can redistribute it and/or modify it
  under the terms of the GNU General Public License.
  This library is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY.
*/

#include "include/rb_gsl_sf.h"

static VALUE rb_gsl_sf_zeta_int(VALUE obj, VALUE n)
{
  VALUE nn;
  if (TYPE(n) != T_FIXNUM) nn = INT2FIX(NUM2INT(n));
  else nn = n;
  return rb_gsl_sf_eval1_int(gsl_sf_zeta_int, nn);
}

static VALUE rb_gsl_sf_zeta_int_e(VALUE obj, VALUE n)
{
  VALUE nn;
  if (TYPE(n) != T_FIXNUM) nn = INT2FIX(NUM2INT(n));
  else nn = n;
  return rb_gsl_sf_eval_e_int(gsl_sf_zeta_int_e, nn);
}

static VALUE rb_gsl_sf_zeta(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval1(gsl_sf_zeta, x);
}

static VALUE rb_gsl_sf_zeta_e(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval_e(gsl_sf_zeta_e, x);
}

static VALUE rb_gsl_sf_hzeta(VALUE obj, VALUE s, VALUE q)
{
  Need_Float(s); Need_Float(q);
  return rb_float_new(gsl_sf_hzeta(NUM2DBL(s), NUM2DBL(q)));
}

static VALUE rb_gsl_sf_hzeta_e(VALUE obj, VALUE s, VALUE q)
{
  return rb_gsl_sf_eval_e_double2(gsl_sf_hzeta_e, s, q);
}

static VALUE rb_gsl_sf_eta_int(VALUE obj, VALUE n)
{
  return rb_gsl_sf_eval1_int(gsl_sf_eta_int, n);
}

static VALUE rb_gsl_sf_eta_int_e(VALUE obj, VALUE n)
{
  return rb_gsl_sf_eval_e_int(gsl_sf_eta_int_e, n);
}

static VALUE rb_gsl_sf_eta(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval1(gsl_sf_eta, x);
}

static VALUE rb_gsl_sf_eta_e(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval_e(gsl_sf_eta_e, x);
}

static VALUE rb_gsl_sf_zetam1_int(VALUE obj, VALUE n)
{
  VALUE nn;
  if (TYPE(n) != T_FIXNUM) nn = INT2FIX(NUM2INT(n));
  else nn = n;
  return rb_gsl_sf_eval1_int(gsl_sf_zetam1_int, nn);
}

static VALUE rb_gsl_sf_zetam1_int_e(VALUE obj, VALUE n)
{
  VALUE nn;
  if (TYPE(n) != T_FIXNUM) nn = INT2FIX(NUM2INT(n));
  else nn = n;
  return rb_gsl_sf_eval_e_int(gsl_sf_zetam1_int_e, nn);
}

static VALUE rb_gsl_sf_zetam1(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval1(gsl_sf_zetam1, x);
}

static VALUE rb_gsl_sf_zetam1_e(VALUE obj, VALUE x)
{
  return rb_gsl_sf_eval_e(gsl_sf_zetam1_e, x);
}

void Init_gsl_sf_zeta(VALUE module)
{
  rb_define_module_function(module, "zeta_int",  rb_gsl_sf_zeta_int, 1);
  rb_define_module_function(module, "zeta_int_e",  rb_gsl_sf_zeta_int_e, 1);
  rb_define_module_function(module, "zeta",  rb_gsl_sf_zeta, 1);
  rb_define_module_function(module, "zeta_e",  rb_gsl_sf_zeta_e, 1);

  rb_define_module_function(module, "hzeta",  rb_gsl_sf_hzeta, 2);
  rb_define_module_function(module, "hzeta_e",  rb_gsl_sf_hzeta_e, 2);
  rb_define_module_function(module, "eta_int",  rb_gsl_sf_eta_int, 1);
  rb_define_module_function(module, "eta_int_e",  rb_gsl_sf_eta_int_e, 1);
  rb_define_module_function(module, "eta",  rb_gsl_sf_eta, 1);
  rb_define_module_function(module, "eta_e",  rb_gsl_sf_eta_e, 1);

  rb_define_module_function(module, "zetam1_int",  rb_gsl_sf_zetam1_int, 1);
  rb_define_module_function(module, "zetam1_int_e",  rb_gsl_sf_zetam1_int_e, 1);
  rb_define_module_function(module, "zetam1",  rb_gsl_sf_zetam1, 1);
  rb_define_module_function(module, "zetam1_e",  rb_gsl_sf_zetam1_e, 1);
}