These are chat archives for symengine/symengine

11th
Jun 2016
Srajan Garg
@srajangarg
Jun 11 2016 08:32
@isuruf I'm having some trouble with using RCP instead of raw pointers. All builds WITH_PIRANHA=YES are failing. This is the concerned line. The function just above operator*() is working fine. Plus a similar function here is working fine too. Can you have a look?
Isuru Fernando
@isuruf
Jun 11 2016 08:33
You can't use SymEngine's RCP like that
Srajan Garg
@srajangarg
Jun 11 2016 08:35
Then how do I safely return a pointer to the pair, plus why is it working on the other line?
Isuru Fernando
@isuruf
Jun 11 2016 08:38
Probably because you are using Teuchos RCP
Do you have to overload operator->? Isn't operator* enough?
Srajan Garg
@srajangarg
Jun 11 2016 08:40
Nope, doesn't work. We have to
error: base operand of ‘->’ has non-pointer type ‘SymEngine::ContainerRevIter<SymEngine::UIntPolyPiranha>’
         if (it->first == 0) {
             ^
Isuru Fernando
@isuruf
Jun 11 2016 08:56
You can use make_shared instead of make_rcp
Isuru Fernando
@isuruf
Jun 11 2016 09:12
make_unique is better
make_unique is only in C++14. Directly construct a std::unique_ptr
Srajan Garg
@srajangarg
Jun 11 2016 13:06
@isuruf can you take a look at symengine/symengine#985
Rajith Vidanaarachchi
@rajithv
Jun 11 2016 17:40
@isuruf When I use static as per your comment on PR 49 I get an error.
The error log:
/home/rajith/.gem/ruby/2.3.0/gems/symengine-0.1.0/ext/symengine/symengine_utils.c: In function ‘sympify’:
/usr/include/ruby-2.3.0/ruby/ruby.h:470:21: error: initializer element is not constant
 #define CLASS_OF(v) rb_class_of((VALUE)(v))
                     ^
/home/rajith/.gem/ruby/2.3.0/gems/symengine-0.1.0/ext/symengine/symengine_utils.c:11:35: note: in expansion of macro ‘CLASS_OF’
     static VALUE rb_cBigDecimal = CLASS_OF(rb_eval_string("BigDecimal.new('0.0001')"));
                                   ^
/home/rajith/.gem/ruby/2.3.0/gems/symengine-0.1.0/ext/symengine/symengine_utils.c:64:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
             c = rb_obj_classname(operand2);
               ^
ext/symengine/CMakeFiles/symengine_ruby.dir/build.make:326: recipe for target 'ext/symengine/CMakeFiles/symengine_ruby.dir/symengine_utils.c.o' failed
make[2]: *** [ext/symengine/CMakeFiles/symengine_ruby.dir/symengine_utils.c.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'ext/symengine/CMakeFiles/symengine_ruby.dir/all' failed
make[1]: *** [ext/symengine/CMakeFiles/symengine_ruby.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

make failed, exit code 2
Isuru Fernando
@isuruf
Jun 11 2016 17:42
Right, in C, that's not going to work.
Rajith Vidanaarachchi
@rajithv
Jun 11 2016 17:43
So I will skip that?
Isuru Fernando
@isuruf
Jun 11 2016 17:44
How about declaring rb_cBigDecimal in ext/symengine/symengine.h and assigning to it in ext/symengine/symengine.c with CLASS_OF(rb_eval_string("BigDecimal.new('1')"))?
Rajith Vidanaarachchi
@rajithv
Jun 11 2016 17:45
ok.. I will do that
Isuru Fernando
@isuruf
Jun 11 2016 17:47
For rb_eval_string you might want to use, require 'bigdecimal'; BigDecimal.new('1')
@rajithv, is BigDecimal installed by default in ruby?
If not, we should fall back to the previous version of checking the class
Rajith Vidanaarachchi
@rajithv
Jun 11 2016 17:51
in the irb, I need to have the require statement. But here I didn't get any error with using that
and yes, it comes installed with ruby
Srajan Garg
@srajangarg
Jun 11 2016 23:14
@isuruf Should a get_coeff method return reference to the coefficient or a copy? I think we need the reference one for internal methods, while a copy is a better idea for external use? What do you think.
Srajan Garg
@srajangarg
Jun 11 2016 23:20
If I am to make the pair contain a reference to integer_class then get_coeff here must return a reference.
Is that correct?