Skip to content

Commit d8b50b7

Browse files
committed
Added Classes for Function types
1 parent d4204cc commit d8b50b7

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed

ext/symengine/symengine.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,42 @@ void Init_symengine() {
6969
//Functions Class
7070
c_function = rb_define_class_under(m_symengine, "Function", c_basic);
7171

72+
//Function SubClasses
73+
c_trig_function = rb_define_class_under(m_symengine, "TrigFunction", c_function);
74+
c_hyperbolic_function = rb_define_class_under(m_symengine, "HyperbolicFunction", c_function);
75+
c_lambertw = rb_define_class_under(m_symengine, "LambertW", c_function);
76+
c_dirichlet_eta = rb_define_class_under(m_symengine, "Dirichlet_eta", c_function);
77+
c_zeta = rb_define_class_under(m_symengine, "Zeta", c_function);
78+
c_gamma = rb_define_class_under(m_symengine, "Gamma", c_function);
79+
80+
//TrigFunction SubClasses
81+
c_sin = rb_define_class_under(m_symengine, "Sin", c_trig_function);
82+
c_cos = rb_define_class_under(m_symengine, "Cos", c_trig_function);
83+
c_tan = rb_define_class_under(m_symengine, "Tan", c_trig_function);
84+
c_csc = rb_define_class_under(m_symengine, "Csc", c_trig_function);
85+
c_sec = rb_define_class_under(m_symengine, "Sec", c_trig_function);
86+
c_cot = rb_define_class_under(m_symengine, "Cot", c_trig_function);
87+
c_asin = rb_define_class_under(m_symengine, "ASin", c_trig_function);
88+
c_acos = rb_define_class_under(m_symengine, "ACos", c_trig_function);
89+
c_atan = rb_define_class_under(m_symengine, "ATan", c_trig_function);
90+
c_acsc = rb_define_class_under(m_symengine, "ACsc", c_trig_function);
91+
c_asec = rb_define_class_under(m_symengine, "ASec", c_trig_function);
92+
c_acot = rb_define_class_under(m_symengine, "ACot", c_trig_function);
93+
94+
//HyperbolicFunction SubClasses
95+
c_sinh = rb_define_class_under(m_symengine, "Sinh", c_hyperbolic_function);
96+
c_cosh = rb_define_class_under(m_symengine, "Cosh", c_hyperbolic_function);
97+
c_tanh = rb_define_class_under(m_symengine, "Tanh", c_hyperbolic_function);
98+
c_csch = rb_define_class_under(m_symengine, "Csch", c_hyperbolic_function);
99+
c_sech = rb_define_class_under(m_symengine, "Sech", c_hyperbolic_function);
100+
c_coth = rb_define_class_under(m_symengine, "Coth", c_hyperbolic_function);
101+
c_asinh = rb_define_class_under(m_symengine, "ASinh", c_hyperbolic_function);
102+
c_acosh = rb_define_class_under(m_symengine, "ACosh", c_hyperbolic_function);
103+
c_atanh = rb_define_class_under(m_symengine, "ATanh", c_hyperbolic_function);
104+
c_acsch = rb_define_class_under(m_symengine, "ACsch", c_hyperbolic_function);
105+
c_asech = rb_define_class_under(m_symengine, "ASech", c_hyperbolic_function);
106+
c_acoth = rb_define_class_under(m_symengine, "ACoth", c_hyperbolic_function);
107+
72108
//SymEngine Functions as Module Level Funcions
73109
rb_define_module_function(m_symengine, "abs", cfunction_abs, 1);
74110
rb_define_module_function(m_symengine, "sin", cfunction_sin, 1);

ext/symengine/symengine.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,36 @@ VALUE c_add;
1616
VALUE c_mul;
1717
VALUE c_pow;
1818
VALUE c_function;
19+
VALUE c_trig_function;
20+
VALUE c_hyperbolic_function;
21+
VALUE c_lambertw;
22+
VALUE c_dirichlet_eta;
23+
VALUE c_zeta;
24+
VALUE c_gamma;
25+
VALUE c_sin;
26+
VALUE c_cos;
27+
VALUE c_tan;
28+
VALUE c_csc;
29+
VALUE c_sec;
30+
VALUE c_cot;
31+
VALUE c_asin;
32+
VALUE c_acos;
33+
VALUE c_atan;
34+
VALUE c_acsc;
35+
VALUE c_asec;
36+
VALUE c_acot;
37+
VALUE c_sinh;
38+
VALUE c_cosh;
39+
VALUE c_tanh;
40+
VALUE c_csch;
41+
VALUE c_sech;
42+
VALUE c_coth;
43+
VALUE c_asinh;
44+
VALUE c_acosh;
45+
VALUE c_atanh;
46+
VALUE c_acsch;
47+
VALUE c_asech;
48+
VALUE c_acoth;
49+
1950

2051
#endif //SYMENGINE_H_

ext/symengine/symengine_macros.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,62 @@ VALUE Klass_of_Basic(const basic_struct *basic_ptr) {
5151
return c_mul;
5252
case SYMENGINE_POW:
5353
return c_pow;
54+
case SYMENGINE_SIN:
55+
return c_sin;
56+
case SYMENGINE_COS:
57+
return c_cos;
58+
case SYMENGINE_TAN:
59+
return c_tan;
60+
case SYMENGINE_CSC:
61+
return c_csc;
62+
case SYMENGINE_SEC:
63+
return c_sec;
64+
case SYMENGINE_COT:
65+
return c_cot;
66+
case SYMENGINE_ASIN:
67+
return c_asin;
68+
case SYMENGINE_ACOS:
69+
return c_acos;
70+
case SYMENGINE_ATAN:
71+
return c_atan;
72+
case SYMENGINE_ACSC:
73+
return c_acsc;
74+
case SYMENGINE_ASEC:
75+
return c_asec;
76+
case SYMENGINE_ACOT:
77+
return c_acot;
78+
case SYMENGINE_SINH:
79+
return c_sinh;
80+
case SYMENGINE_COSH:
81+
return c_cosh;
82+
case SYMENGINE_TANH:
83+
return c_tanh;
84+
case SYMENGINE_CSCH:
85+
return c_csch;
86+
case SYMENGINE_SECH:
87+
return c_sech;
88+
case SYMENGINE_COTH:
89+
return c_coth;
90+
case SYMENGINE_ASINH:
91+
return c_asinh;
92+
case SYMENGINE_ACOSH:
93+
return c_acosh;
94+
case SYMENGINE_ATANH:
95+
return c_atanh;
96+
case SYMENGINE_ACSCH:
97+
return c_acsch;
98+
case SYMENGINE_ASECH:
99+
return c_asech;
100+
case SYMENGINE_ACOTH:
101+
return c_acoth;
102+
case SYMENGINE_LAMBERTW:
103+
return c_lambertw;
104+
case SYMENGINE_DIRICHLET_ETA:
105+
return c_dirichlet_eta;
106+
case SYMENGINE_ZETA:
107+
return c_zeta;
108+
case SYMENGINE_GAMMA:
109+
return c_gamma;
54110
default:
55111
return c_basic;
56112
}

0 commit comments

Comments
 (0)