symengine 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +76 -1
- data/README.md +11 -29
- data/lib/symengine/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/lib/symengine/CMakeFiles/progress.marks +1 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/C.includecache +138 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/DependInfo.cmake +33 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_basic.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_integer.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_rational.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_symbol.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine_macros.c.o +0 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/build.make +241 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/cmake_clean.cmake +15 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/depend.internal +94 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/depend.make +94 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/flags.make +8 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/link.txt +1 -0
- data/lib/symengine/CMakeFiles/symengine_ruby.dir/progress.make +7 -0
- data/lib/symengine/CTestTestfile.cmake +6 -0
- data/lib/symengine/Makefile +347 -0
- data/lib/symengine/cmake_install.cmake +34 -0
- data/lib/symengine/symengine.so +0 -0
- metadata +24 -19
- data/CMakeLists.txt +0 -15
- data/ext/symengine/CMakeLists.txt +0 -25
- data/ext/symengine/extconf.rb +0 -1
- data/ext/symengine/ruby_basic.c +0 -254
- data/ext/symengine/ruby_basic.h +0 -53
- data/ext/symengine/ruby_integer.c +0 -8
- data/ext/symengine/ruby_integer.h +0 -8
- data/ext/symengine/ruby_rational.c +0 -23
- data/ext/symengine/ruby_rational.h +0 -8
- data/ext/symengine/ruby_symbol.c +0 -13
- data/ext/symengine/ruby_symbol.h +0 -8
- data/ext/symengine/symengine.c +0 -49
- data/ext/symengine/symengine.h +0 -15
- data/ext/symengine/symengine_macros.c +0 -49
- data/ext/symengine/symengine_macros.h +0 -21
@@ -1,23 +0,0 @@
|
|
1
|
-
#include "ruby_rational.h"
|
2
|
-
|
3
|
-
VALUE crational_init(VALUE self, VALUE rat_value) {
|
4
|
-
basic_struct *this;
|
5
|
-
basic num_basic, den_basic;
|
6
|
-
|
7
|
-
basic_new_stack(num_basic);
|
8
|
-
basic_new_stack(den_basic);
|
9
|
-
|
10
|
-
Data_Get_Struct(self, basic_struct, this);
|
11
|
-
|
12
|
-
VALUE num, den;
|
13
|
-
num = rb_funcall(rat_value, rb_intern("numerator"), 0, NULL);
|
14
|
-
den = rb_funcall(rat_value, rb_intern("denominator"), 0, NULL);
|
15
|
-
|
16
|
-
GET_SYMINTFROMVAL(num, num_basic);
|
17
|
-
GET_SYMINTFROMVAL(den, den_basic);
|
18
|
-
|
19
|
-
rational_set(this, num_basic, den_basic);
|
20
|
-
basic_free_stack(num_basic);
|
21
|
-
basic_free_stack(den_basic);
|
22
|
-
return self;
|
23
|
-
}
|
data/ext/symengine/ruby_symbol.c
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#include "ruby_symbol.h"
|
2
|
-
|
3
|
-
VALUE csymbol_init(VALUE self, VALUE name) {
|
4
|
-
Check_Type(name, T_STRING);
|
5
|
-
basic_struct *this;
|
6
|
-
char *str_ptr = StringValueCStr(name);
|
7
|
-
|
8
|
-
Data_Get_Struct(self, basic_struct, this);
|
9
|
-
|
10
|
-
symbol_set(this, str_ptr);
|
11
|
-
|
12
|
-
return self;
|
13
|
-
}
|
data/ext/symengine/ruby_symbol.h
DELETED
data/ext/symengine/symengine.c
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
#include "ruby_basic.h"
|
2
|
-
#include "ruby_symbol.h"
|
3
|
-
#include "ruby_integer.h"
|
4
|
-
#include "ruby_rational.h"
|
5
|
-
#include "symengine.h"
|
6
|
-
|
7
|
-
///////////////////
|
8
|
-
// Ruby Bindings //
|
9
|
-
///////////////////
|
10
|
-
|
11
|
-
void Init_symengine() {
|
12
|
-
m_symengine = rb_define_module("SymEngine");
|
13
|
-
|
14
|
-
//Basic class
|
15
|
-
c_basic = rb_define_class_under(m_symengine, "Basic", rb_cObject);
|
16
|
-
rb_define_alloc_func(c_basic, cbasic_alloc);
|
17
|
-
rb_define_method(c_basic, "+", cbasic_add, 1);
|
18
|
-
rb_define_method(c_basic, "-", cbasic_sub, 1);
|
19
|
-
rb_define_method(c_basic, "*", cbasic_mul, 1);
|
20
|
-
rb_define_method(c_basic, "/", cbasic_div, 1);
|
21
|
-
rb_define_method(c_basic, "**", cbasic_pow, 1);
|
22
|
-
rb_define_method(c_basic, "diff", cbasic_diff, 1);
|
23
|
-
rb_define_method(c_basic, "==", cbasic_eq, 1);
|
24
|
-
rb_define_method(c_basic, "eql?", cbasic_eq, 1);
|
25
|
-
rb_define_method(c_basic, "!=", cbasic_neq, 1);
|
26
|
-
rb_define_method(c_basic, "-@", cbasic_neg, 0);
|
27
|
-
rb_define_method(c_basic, "to_s", cbasic_to_str, 0);
|
28
|
-
rb_define_method(c_basic, "expand", cbasic_expand, 0);
|
29
|
-
rb_define_method(c_basic, "args", cbasic_get_args, 0);
|
30
|
-
rb_define_protected_method(c_basic, "pr_free_symbols", cbasic_free_symbols, 0);
|
31
|
-
rb_define_method(c_basic, "hash", cbasic_hash, 0);
|
32
|
-
rb_define_method(c_basic, "subs", cbasic_subs, -1);
|
33
|
-
rb_define_method(c_basic, "coerce", cbasic_coerce, 1);
|
34
|
-
|
35
|
-
//Symbol class
|
36
|
-
c_symbol = rb_define_class_under(m_symengine, "Symbol", c_basic);
|
37
|
-
rb_define_alloc_func(c_symbol, cbasic_alloc);
|
38
|
-
rb_define_method(c_symbol, "initialize", csymbol_init, 1);
|
39
|
-
|
40
|
-
//Integer class
|
41
|
-
c_integer = rb_define_class_under(m_symengine, "Integer", c_basic);
|
42
|
-
rb_define_alloc_func(c_integer, cbasic_alloc);
|
43
|
-
rb_define_method(c_integer, "initialize", cinteger_init, 1);
|
44
|
-
|
45
|
-
//Rational class
|
46
|
-
c_rational = rb_define_class_under(m_symengine, "Rational", c_basic);
|
47
|
-
rb_define_alloc_func(c_rational, cbasic_alloc);
|
48
|
-
rb_define_method(c_rational, "initialize", crational_init, 1);
|
49
|
-
}
|
data/ext/symengine/symengine.h
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#ifndef SYMENGINE_H_
|
2
|
-
#define SYMENGINE_H_
|
3
|
-
|
4
|
-
#include "ruby.h"
|
5
|
-
|
6
|
-
//variable name for a module starts with m
|
7
|
-
VALUE m_symengine;
|
8
|
-
|
9
|
-
//variable names for classes begin with c
|
10
|
-
VALUE c_basic;
|
11
|
-
VALUE c_symbol;
|
12
|
-
VALUE c_integer;
|
13
|
-
VALUE c_rational;
|
14
|
-
|
15
|
-
#endif //SYMENGINE_H_
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#include "symengine_macros.h"
|
2
|
-
#include "symengine.h"
|
3
|
-
|
4
|
-
void sympify(VALUE operand2, basic_struct *cbasic_operand2) {
|
5
|
-
basic_struct *temp;
|
6
|
-
VALUE new_operand2, num, den;
|
7
|
-
|
8
|
-
switch(TYPE(operand2)) {
|
9
|
-
case T_FIXNUM:
|
10
|
-
case T_BIGNUM:
|
11
|
-
GET_SYMINTFROMVAL(operand2, cbasic_operand2);
|
12
|
-
break;
|
13
|
-
|
14
|
-
case T_RATIONAL:
|
15
|
-
num = rb_funcall(operand2, rb_intern("numerator"), 0, NULL);
|
16
|
-
den = rb_funcall(operand2, rb_intern("denominator"), 0, NULL);
|
17
|
-
|
18
|
-
basic num_basic, den_basic;
|
19
|
-
basic_new_stack(num_basic);
|
20
|
-
basic_new_stack(den_basic);
|
21
|
-
|
22
|
-
GET_SYMINTFROMVAL(num, num_basic);
|
23
|
-
GET_SYMINTFROMVAL(den, den_basic);
|
24
|
-
|
25
|
-
rational_set(cbasic_operand2, num_basic, den_basic);
|
26
|
-
|
27
|
-
basic_free_stack(num_basic);
|
28
|
-
basic_free_stack(den_basic);
|
29
|
-
break;
|
30
|
-
|
31
|
-
case T_DATA:
|
32
|
-
Data_Get_Struct(operand2, basic_struct, temp);
|
33
|
-
basic_assign(cbasic_operand2, temp);
|
34
|
-
break;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
VALUE Klass_of_Basic(const basic_struct *basic_ptr) {
|
39
|
-
switch(basic_get_type(basic_ptr)) {
|
40
|
-
case SYMENGINE_SYMBOL:
|
41
|
-
return c_symbol;
|
42
|
-
case SYMENGINE_INTEGER:
|
43
|
-
return c_integer;
|
44
|
-
case SYMENGINE_RATIONAL:
|
45
|
-
return c_rational;
|
46
|
-
default:
|
47
|
-
return c_basic;
|
48
|
-
}
|
49
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#ifndef SYMENGINE_MACROS_H_
|
2
|
-
#define SYMENGINE_MACROS_H_
|
3
|
-
|
4
|
-
#include "ruby.h"
|
5
|
-
#include "symengine/cwrapper.h"
|
6
|
-
|
7
|
-
//Returns the pointer wrapped inside the Ruby VALUE
|
8
|
-
void sympify(VALUE operand2, basic_struct *cbasic_operand2);
|
9
|
-
//Returns the Ruby class of the corresponding basic_struct pointer
|
10
|
-
VALUE Klass_of_Basic(const basic_struct *basic_ptr);
|
11
|
-
|
12
|
-
//Obtains the value from Ruby Fixnum or Bignum to an already allocated basic_struct
|
13
|
-
#define GET_SYMINTFROMVAL(num_value, this) { \
|
14
|
-
if ( ! RB_TYPE_P(num_value, T_FIXNUM) && ! RB_TYPE_P(num_value, T_BIGNUM) ) { \
|
15
|
-
rb_raise(rb_eTypeError, "Invalid Type: Fixnum or Bignum required"); \
|
16
|
-
} \
|
17
|
-
VALUE Rb_Temp_String = rb_funcall(num_value, rb_intern("to_s"), 0, NULL); \
|
18
|
-
integer_set_str(this, StringValueCStr(Rb_Temp_String)); \
|
19
|
-
}
|
20
|
-
|
21
|
-
#endif //SYMENGINE_MACROS_H_
|