These are chat archives for symengine/symengine

29th
May 2017
Shikhar Jaiswal
@ShikharJ
May 29 2017 13:42
@isuruf Inheriting from both Boolean and TwoArgFunction would cause the diamond inheritance ambiguity. One way of resolving that problem would be to use only TwoArgFunction. Other would be to declare class Boolean : public Basic as class Boolean : public virtual Basic , and the same with all the base classes of TwoArgFunction. What should be done here?
Isuru Fernando
@isuruf
May 29 2017 13:43
Second one.
I think you only need Boolean, Function and TwoArgFunction
Shikhar Jaiswal
@ShikharJ
May 29 2017 13:44
Yes, these three.
Shikhar Jaiswal
@ShikharJ
May 29 2017 13:49
I tried it with the above, but I'm getting the following error:
/home/shikhar/symengine/symengine/symengine_casts.h:90:13: error: cannot convert from pointer to base class ‘SymEngine::Basic’ to pointer to derived class ‘SymEngine::OneArgFunction’ because the base is virtual
     return *static_cast<ToAsPointer>(&f);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/shikhar/symengine/symengine/symengine_casts.h: In instantiation ofTo SymEngine::down_cast(From&) [with To = const SymEngine::TwoArgFunction&; From = const SymEngine::Basic]’:
/home/shikhar/symengine/symengine/functions.h:121:59:   required from here
/home/shikhar/symengine/symengine/symengine_casts.h:90:13: error: cannot convert from pointer to base class ‘SymEngine::Basic’ to pointer to derived class ‘SymEngine::TwoArgFunction’ because the base is virtual
/home/shikhar/symengine/symengine/symengine_casts.h: In instantiation ofTo SymEngine::down_cast(From&) [with To = const SymEngine::MultiArgFunction&; From = const SymEngine::Basic]’:
/home/shikhar/symengine/symengine/functions.h:174:68:   required from here
/home/shikhar/symengine/symengine/symengine_casts.h:90:13: error: cannot convert from pointer to base class ‘SymEngine::Basic’ to pointer to derived class ‘SymEngine::MultiArgFunction’ because the base is virtual
Shikhar Jaiswal
@ShikharJ
May 29 2017 13:56
@isuruf What exactly is causing the error?
Isuru Fernando
@isuruf
May 29 2017 13:57
The error message says it all. error: cannot convert from pointer to base class ‘SymEngine::Basic’ to pointer to derived class ‘SymEngine::OneArgFunction’ because the base is virtual
When a class is declared to have a virtual base, then how the object is stored in memory is changed.
therefore you can't access the derived class from a base class pointer
Shikhar Jaiswal
@ShikharJ
May 29 2017 14:01
Is there a possible workaround for this? I can't seem to find anything.
Isuru Fernando
@isuruf
May 29 2017 14:02
Nope
Shikhar Jaiswal
@ShikharJ
May 29 2017 14:02
So, should I just use TwoArgFunction or should I leave it as it is?
Isuru Fernando
@isuruf
May 29 2017 14:09
Change TwoArgFunction to be a template class
template <class BaseClass>
class TwoArgBasic : public BaseClass {

}
Then TwoArgFunction = TwoArgBasic<Function> and Relational = TwoArgBasic<Boolean>
Also do we need another file for this? I think logic.h along with other booleans is okay
Shikhar Jaiswal
@ShikharJ
May 29 2017 14:13
SymPy has them separated, so I created another file. I'll shift them as well.
Isuru Fernando
@isuruf
May 29 2017 14:16
@ShikharJ, what's the plan for the rest of the week?
Shikhar Jaiswal
@ShikharJ
May 29 2017 14:20
After I'm done with Relationals, I'd start working on some more classes that I had planned on implementing in SymEngine, and at the same time, clearing out sympy/physics as well.
Isuru Fernando
@isuruf
May 29 2017 14:22
Great. Keep me updated
Shikhar Jaiswal
@ShikharJ
May 29 2017 14:22
Surely.