symengine 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +76 -1
  3. data/README.md +11 -29
  4. data/lib/symengine/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  5. data/lib/symengine/CMakeFiles/progress.marks +1 -0
  6. data/lib/symengine/CMakeFiles/symengine_ruby.dir/C.includecache +138 -0
  7. data/lib/symengine/CMakeFiles/symengine_ruby.dir/DependInfo.cmake +33 -0
  8. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_basic.c.o +0 -0
  9. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_integer.c.o +0 -0
  10. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_rational.c.o +0 -0
  11. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_symbol.c.o +0 -0
  12. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine.c.o +0 -0
  13. data/lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine_macros.c.o +0 -0
  14. data/lib/symengine/CMakeFiles/symengine_ruby.dir/build.make +241 -0
  15. data/lib/symengine/CMakeFiles/symengine_ruby.dir/cmake_clean.cmake +15 -0
  16. data/lib/symengine/CMakeFiles/symengine_ruby.dir/depend.internal +94 -0
  17. data/lib/symengine/CMakeFiles/symengine_ruby.dir/depend.make +94 -0
  18. data/lib/symengine/CMakeFiles/symengine_ruby.dir/flags.make +8 -0
  19. data/lib/symengine/CMakeFiles/symengine_ruby.dir/link.txt +1 -0
  20. data/lib/symengine/CMakeFiles/symengine_ruby.dir/progress.make +7 -0
  21. data/lib/symengine/CTestTestfile.cmake +6 -0
  22. data/lib/symengine/Makefile +347 -0
  23. data/lib/symengine/cmake_install.cmake +34 -0
  24. data/lib/symengine/symengine.so +0 -0
  25. metadata +24 -19
  26. data/CMakeLists.txt +0 -15
  27. data/ext/symengine/CMakeLists.txt +0 -25
  28. data/ext/symengine/extconf.rb +0 -1
  29. data/ext/symengine/ruby_basic.c +0 -254
  30. data/ext/symengine/ruby_basic.h +0 -53
  31. data/ext/symengine/ruby_integer.c +0 -8
  32. data/ext/symengine/ruby_integer.h +0 -8
  33. data/ext/symengine/ruby_rational.c +0 -23
  34. data/ext/symengine/ruby_rational.h +0 -8
  35. data/ext/symengine/ruby_symbol.c +0 -13
  36. data/ext/symengine/ruby_symbol.h +0 -8
  37. data/ext/symengine/symengine.c +0 -49
  38. data/ext/symengine/symengine.h +0 -15
  39. data/ext/symengine/symengine_macros.c +0 -49
  40. data/ext/symengine/symengine_macros.h +0 -21
@@ -0,0 +1,34 @@
1
+ # Install script for directory: /home/abinashmeher999/gsoc/symengine/symengine/ruby/lib/symengine
2
+
3
+ # Set the install prefix
4
+ IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
5
+ SET(CMAKE_INSTALL_PREFIX "/usr/local")
6
+ ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
7
+ STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
8
+
9
+ # Set the install configuration name.
10
+ IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
11
+ IF(BUILD_TYPE)
12
+ STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
13
+ CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
14
+ ELSE(BUILD_TYPE)
15
+ SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
16
+ ENDIF(BUILD_TYPE)
17
+ MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
18
+ ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
19
+
20
+ # Set the component getting installed.
21
+ IF(NOT CMAKE_INSTALL_COMPONENT)
22
+ IF(COMPONENT)
23
+ MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
24
+ SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
25
+ ELSE(COMPONENT)
26
+ SET(CMAKE_INSTALL_COMPONENT)
27
+ ENDIF(COMPONENT)
28
+ ENDIF(NOT CMAKE_INSTALL_COMPONENT)
29
+
30
+ # Install shared libraries without execute permission?
31
+ IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
32
+ SET(CMAKE_INSTALL_SO_NO_EXE "1")
33
+ ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
34
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abinash Meher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,33 +72,38 @@ description: This gem provides a Ruby interface for SymEngine, a fast C++ librar
72
72
  email:
73
73
  - abinashdakshana999@gmail.com
74
74
  executables: []
75
- extensions:
76
- - ext/symengine/extconf.rb
75
+ extensions: []
77
76
  extra_rdoc_files: []
78
77
  files:
79
- - CMakeLists.txt
80
78
  - LICENSE
81
79
  - README.md
82
80
  - bin/callgrind_test.sh
83
81
  - bin/gdb.sh
84
82
  - bin/valgrind_test.sh
85
- - ext/symengine/CMakeLists.txt
86
- - ext/symengine/extconf.rb
87
- - ext/symengine/ruby_basic.c
88
- - ext/symengine/ruby_basic.h
89
- - ext/symengine/ruby_integer.c
90
- - ext/symengine/ruby_integer.h
91
- - ext/symengine/ruby_rational.c
92
- - ext/symengine/ruby_rational.h
93
- - ext/symengine/ruby_symbol.c
94
- - ext/symengine/ruby_symbol.h
95
- - ext/symengine/symengine.c
96
- - ext/symengine/symengine.h
97
- - ext/symengine/symengine_macros.c
98
- - ext/symengine/symengine_macros.h
99
83
  - lib/symengine.rb
84
+ - lib/symengine/CMakeFiles/CMakeDirectoryInformation.cmake
85
+ - lib/symengine/CMakeFiles/progress.marks
86
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/C.includecache
87
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/DependInfo.cmake
88
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_basic.c.o
89
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_integer.c.o
90
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_rational.c.o
91
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/ruby_symbol.c.o
92
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine.c.o
93
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/__/__/ext/symengine/symengine_macros.c.o
94
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/build.make
95
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/cmake_clean.cmake
96
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/depend.internal
97
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/depend.make
98
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/flags.make
99
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/link.txt
100
+ - lib/symengine/CMakeFiles/symengine_ruby.dir/progress.make
101
+ - lib/symengine/CTestTestfile.cmake
102
+ - lib/symengine/Makefile
100
103
  - lib/symengine/basic.rb
104
+ - lib/symengine/cmake_install.cmake
101
105
  - lib/symengine/iruby.rb
106
+ - lib/symengine/symengine.so
102
107
  homepage: https://github.com/sympy/symengine
103
108
  licenses:
104
109
  - MIT
@@ -1,15 +0,0 @@
1
- cmake_minimum_required(VERSION 2.8)
2
- project(ruby_wrapper)
3
-
4
- set(CMAKE_PREFIX_PATH ${SymEngine_DIR} ${CMAKE_PREFIX_PATH})
5
- find_package(SymEngine 0.1.0 REQUIRED CONFIG
6
- PATH_SUFFIXES lib/cmake/symengine CMake/)
7
- set(CMAKE_BUILD_TYPE ${SYMENGINE_BUILD_TYPE})
8
- set(CMAKE_CXX_FLAGS_RELEASE ${SYMENGINE_CXX_FLAGS_RELEASE})
9
- set(CMAKE_CXX_FLAGS_DEBUG ${SYMENGINE_CXX_FLAGS_DEBUG})
10
- include_directories(${SYMENGINE_INCLUDE_DIRS})
11
-
12
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
13
- find_package(Ruby REQUIRED)
14
-
15
- add_subdirectory(ext/symengine)
@@ -1,25 +0,0 @@
1
- set(RUBY_WRAPPER_SRC
2
- ruby_basic.c
3
- ruby_symbol.c
4
- ruby_integer.c
5
- ruby_rational.c
6
- symengine_macros.c
7
- symengine.c
8
- )
9
-
10
- include_directories(BEFORE ${RUBY_INCLUDE_DIRS})
11
-
12
- add_library(symengine_ruby SHARED ${RUBY_WRAPPER_SRC})
13
- target_link_libraries(symengine_ruby ${SYMENGINE_LIBRARIES} ${RUBY_LIBRARIES})
14
- set_target_properties(symengine_ruby PROPERTIES
15
- PREFIX ""
16
- OUTPUT_NAME "symengine"
17
- LIBRARY_OUTPUT_DIRECTORY "${ruby_wrapper_BINARY_DIR}/lib/symengine"
18
- )
19
-
20
- # Ruby gems require a install target.
21
- install(TARGETS symengine_ruby
22
- RUNTIME DESTINATION lib/symengine
23
- ARCHIVE DESTINATION lib/symengine
24
- LIBRARY DESTINATION lib/symengine
25
- )
@@ -1 +0,0 @@
1
- exec 'cmake -DCMAKE_INSTALL_PREFIX=../../ %s ../../ ' % [ARGV.join(" ")]
@@ -1,254 +0,0 @@
1
- #include "ruby_basic.h"
2
-
3
- void cbasic_free(void *ptr){
4
- basic_struct *basic_ptr = ptr;
5
- basic_free_stack(basic_ptr);
6
- }
7
-
8
- void cbasic_free_heap(void *ptr) {
9
- basic_struct *basic_ptr = ptr;
10
- basic_free_heap(basic_ptr);
11
- }
12
-
13
- VALUE cbasic_alloc(VALUE klass){
14
- basic_struct *struct_ptr = basic_new_heap();
15
- return Data_Wrap_Struct(klass, NULL, cbasic_free_heap, struct_ptr);
16
- }
17
-
18
- VALUE cbasic_binary_op(VALUE self, VALUE operand2, void (*cwfunc_ptr)(basic_struct*, const basic_struct*, const basic_struct*)){
19
- basic_struct *this, *cresult;
20
- VALUE result;
21
-
22
- basic cbasic_operand2;
23
- basic_new_stack(cbasic_operand2);
24
-
25
- Data_Get_Struct(self, basic_struct, this);
26
- sympify(operand2, cbasic_operand2);
27
-
28
- cresult = basic_new_heap();
29
- cwfunc_ptr(cresult, this, cbasic_operand2);
30
- result = Data_Wrap_Struct(Klass_of_Basic(cresult), NULL , cbasic_free_heap, cresult);
31
- basic_free_stack(cbasic_operand2);
32
-
33
- return result;
34
- }
35
-
36
- VALUE cbasic_unary_op(VALUE self, void (*cwfunc_ptr)(basic_struct*, const basic_struct*)){
37
- basic_struct *this, *cresult;
38
- VALUE result;
39
-
40
- Data_Get_Struct(self, basic_struct, this);
41
-
42
- cresult = basic_new_heap();
43
- cwfunc_ptr(cresult, this);
44
- result = Data_Wrap_Struct(Klass_of_Basic(cresult), NULL , cbasic_free_heap, cresult);
45
-
46
- return result;
47
- }
48
-
49
- VALUE cbasic_add(VALUE self, VALUE operand2){
50
- return cbasic_binary_op(self, operand2, basic_add);
51
- }
52
-
53
- VALUE cbasic_sub(VALUE self, VALUE operand2){
54
- return cbasic_binary_op(self, operand2, basic_sub);
55
- }
56
-
57
- VALUE cbasic_mul(VALUE self, VALUE operand2){
58
- return cbasic_binary_op(self, operand2, basic_mul);
59
- }
60
-
61
- VALUE cbasic_div(VALUE self, VALUE operand2){
62
- return cbasic_binary_op(self, operand2, basic_div);
63
- }
64
-
65
- VALUE cbasic_pow(VALUE self, VALUE operand2){
66
- return cbasic_binary_op(self, operand2, basic_pow);
67
- }
68
-
69
- VALUE cbasic_diff(VALUE self, VALUE operand2) {
70
- basic_struct *this, *cresult;
71
- VALUE result;
72
-
73
- basic cbasic_operand2;
74
- basic_new_stack(cbasic_operand2);
75
-
76
- Data_Get_Struct(self, basic_struct, this);
77
- sympify(operand2, cbasic_operand2);
78
-
79
- cresult = basic_new_heap();
80
- int status = basic_diff(cresult, this, cbasic_operand2);
81
- if (status == 0) {
82
- basic_free_stack(cbasic_operand2);
83
- basic_free_heap(cresult);
84
- return Qnil;
85
- }
86
- result = Data_Wrap_Struct(Klass_of_Basic(cresult), NULL , cbasic_free_heap, cresult);
87
- basic_free_stack(cbasic_operand2);
88
-
89
- return result;
90
- }
91
-
92
- VALUE cbasic_eq(VALUE self, VALUE operand2) {
93
- basic_struct *this;
94
-
95
- basic cbasic_operand2;
96
- basic_new_stack(cbasic_operand2);
97
- Data_Get_Struct(self, basic_struct, this);
98
- sympify(operand2, cbasic_operand2);
99
-
100
- VALUE ret_val = basic_eq(this, cbasic_operand2) ? Qtrue : Qfalse;
101
- basic_free_stack(cbasic_operand2);
102
-
103
- return ret_val;
104
- }
105
-
106
- VALUE cbasic_neq(VALUE self, VALUE operand2) {
107
- basic_struct *this;
108
-
109
- basic cbasic_operand2;
110
- basic_new_stack(cbasic_operand2);
111
- Data_Get_Struct(self, basic_struct, this);
112
- sympify(operand2, cbasic_operand2);
113
-
114
- VALUE ret_val = basic_neq(this, cbasic_operand2) ? Qtrue : Qfalse;
115
- basic_free_stack(cbasic_operand2);
116
-
117
- return ret_val;
118
- }
119
-
120
- VALUE cbasic_neg(VALUE self){
121
- return cbasic_unary_op(self, basic_neg);
122
- }
123
-
124
- VALUE cbasic_get_args(VALUE self) {
125
- basic_struct *this, *iterator_basic;
126
- CVecBasic *args = vecbasic_new();
127
- int size = 0;
128
-
129
- Data_Get_Struct(self, basic_struct, this);
130
- basic_get_args(this, args);
131
-
132
- size = vecbasic_size(args);
133
- VALUE ruby_array = rb_ary_new2(size);
134
- int i = 0;
135
- VALUE temp = NULL;
136
- for(i = 0; i < size; i++) {
137
- basic_struct *temp_basic = basic_new_heap();
138
- vecbasic_get(args, i, temp_basic);
139
- temp = Data_Wrap_Struct(rb_obj_class(self), NULL , cbasic_free_heap, temp_basic);
140
- rb_ary_push(ruby_array, temp);
141
- }
142
- vecbasic_free(args);
143
- return ruby_array;
144
- }
145
-
146
- VALUE cbasic_free_symbols(VALUE self) {
147
- basic_struct *this, *iterator_basic;
148
- CSetBasic *symbols = setbasic_new();
149
- int size = 0;
150
-
151
- Data_Get_Struct(self, basic_struct, this);
152
- basic_free_symbols(this, symbols);
153
-
154
- size = setbasic_size(symbols);
155
- VALUE ruby_array = rb_ary_new2(size);
156
- int i = 0;
157
- VALUE temp = NULL;
158
- for(i = 0; i < size; i++) {
159
- basic_struct *temp_basic = basic_new_heap();
160
- setbasic_get(symbols, i, temp_basic);
161
- temp = Data_Wrap_Struct(rb_obj_class(self), NULL , cbasic_free_heap, temp_basic);
162
- rb_ary_push(ruby_array, temp);
163
- }
164
- setbasic_free(symbols);
165
- return ruby_array;
166
- }
167
-
168
- VALUE cbasic_to_str(VALUE self){
169
- basic_struct *this;
170
- char *str_ptr;
171
- VALUE result;
172
-
173
- Data_Get_Struct(self, basic_struct, this);
174
-
175
- str_ptr = basic_str(this);
176
- result = rb_str_new_cstr(str_ptr);
177
- basic_str_free(str_ptr);
178
-
179
- return result;
180
- }
181
-
182
- VALUE cbasic_expand(VALUE self){
183
- return cbasic_unary_op(self, basic_expand);
184
- }
185
-
186
- VALUE cbasic_hash(VALUE self){
187
- basic_struct *this;
188
- Data_Get_Struct(self, basic_struct, this);
189
- // All ruby objects return FIXNUM when `hash` method is called.
190
- // Though this function returns BIGNUM it won't be a problem, since
191
- // we need proper comparison only among objects in SymEngine.
192
- // The objects that should have the same hash will always match
193
- // and when comparing to the FIXNUM from hash of other ruby objects,
194
- // it will return false as it is supposed to.
195
- // However, an alternate implementation is given below
196
- // long lhash = basic_hash(this) % FIX2LONG(FIXNUM_MAX);
197
- // return LONG2FIX(lhash);
198
- return SIZET2NUM(basic_hash(this));
199
- }
200
-
201
- int insert_entries(VALUE key, VALUE val, VALUE input) {
202
- CMapBasicBasic *cmapbb;
203
- Data_Get_Struct(input, CMapBasicBasic, cmapbb);
204
-
205
- basic ckey, cval;
206
- basic_new_stack(ckey);
207
- basic_new_stack(cval);
208
- sympify(key, ckey);
209
- sympify(val, cval);
210
-
211
- mapbasicbasic_insert(cmapbb, ckey, cval);
212
-
213
- basic_free_stack(ckey);
214
- basic_free_stack(cval);
215
- }
216
-
217
- VALUE cbasic_subs(int argc, VALUE *argv, VALUE self) {
218
- basic_struct *this, *cresult;
219
- cresult = basic_new_heap();
220
-
221
- VALUE val_a, val_b;
222
- Data_Get_Struct(self, basic_struct, this);
223
-
224
- rb_scan_args(argc, argv, "11", &val_a, &val_b); // 1 mandatory and 1 optional parameter
225
- if (argc == 1) {
226
- Check_Type(val_a, T_HASH);
227
- CMapBasicBasic *cmapbb = mapbasicbasic_new();
228
- VALUE mapbb = Data_Wrap_Struct(rb_cObject, NULL, mapbasicbasic_free, cmapbb);
229
-
230
- rb_hash_foreach(val_a, insert_entries, mapbb);
231
- basic_subs(cresult, this, cmapbb);
232
- } else {
233
- basic a, b;
234
- basic_new_stack(a);
235
- basic_new_stack(b);
236
-
237
- sympify(val_a, a);
238
- sympify(val_b, b);
239
- basic_subs2(cresult, this, a, b);
240
-
241
- basic_free_stack(a);
242
- basic_free_stack(b);
243
- }
244
-
245
- return Data_Wrap_Struct(Klass_of_Basic(cresult), NULL, cbasic_free_heap, cresult);
246
- }
247
-
248
- VALUE cbasic_coerce(VALUE self, VALUE other){
249
- basic_struct *cbasic_operand2;
250
- cbasic_operand2 = basic_new_heap();
251
- sympify(other, cbasic_operand2);
252
- VALUE new_other = Data_Wrap_Struct(Klass_of_Basic(cbasic_operand2), NULL , cbasic_free_heap, cbasic_operand2);
253
- return rb_assoc_new(new_other, self);
254
- }
@@ -1,53 +0,0 @@
1
- #ifndef RUBY_BASIC_H_
2
- #define RUBY_BASIC_H_
3
-
4
- #include <ruby.h>
5
- #include <symengine/cwrapper.h>
6
-
7
- #include "symengine_macros.h"
8
-
9
- void cbasic_free(void *ptr);
10
-
11
- void cbasic_free_heap(void *ptr);
12
-
13
- VALUE cbasic_alloc(VALUE klass);
14
-
15
- VALUE cbasic_binary_op(VALUE self, VALUE operand2, void (*cwfunc_ptr)(basic_struct*, const basic_struct*, const basic_struct*));
16
-
17
- VALUE cbasic_unary_op(VALUE self, void (*cwfunc_ptr)(basic_struct*, const basic_struct*));
18
-
19
- VALUE cbasic_add(VALUE self, VALUE operand2);
20
-
21
- VALUE cbasic_sub(VALUE self, VALUE operand2);
22
-
23
- VALUE cbasic_mul(VALUE self, VALUE operand2);
24
-
25
- VALUE cbasic_div(VALUE self, VALUE operand2);
26
-
27
- VALUE cbasic_pow(VALUE self, VALUE operand2);
28
-
29
- VALUE cbasic_diff(VALUE self, VALUE operand2);
30
-
31
- VALUE cbasic_eq(VALUE self, VALUE operand2);
32
-
33
- VALUE cbasic_neq(VALUE self, VALUE operand2);
34
-
35
- VALUE cbasic_neg(VALUE self);
36
-
37
- VALUE cbasic_get_args(VALUE self);
38
-
39
- VALUE cbasic_free_symbols(VALUE self);
40
-
41
- VALUE cbasic_to_str(VALUE self);
42
-
43
- VALUE cbasic_expand(VALUE self);
44
-
45
- VALUE cbasic_hash(VALUE self);
46
-
47
- int insert_entries(VALUE key, VALUE val, VALUE val_map_basic_basic);
48
-
49
- VALUE cbasic_subs(int argc, VALUE *argv, VALUE self);
50
-
51
- VALUE cbasic_coerce(VALUE self, VALUE other);
52
-
53
- #endif //RUBY_BASIC_H_