These are chat archives for symengine/symengine

10th
Mar 2016
Isuru Fernando
@isuruf
Mar 10 2016 02:10
It doesn't need to be right? You can keep them in different types.
As for your question, you'll need a coercion framework to do that
Charles Chen
@chenchfort
Mar 10 2016 02:10
@isuruf Do you have a solution to the current build errors we’re getting on TravisCI and Appveyor?
Isuru Fernando
@isuruf
Mar 10 2016 02:12
That's an unrelated issue. I'll fix it asap.
Isuru Fernando
@isuruf
Mar 10 2016 02:23
@certik, @bluescarni,
ostream << operator methods in dict.hare declared in global namespace which I assume is because some compilers may not have ADL.
With gcc though, there is a problem because piranha have its methods in piranha namespace and when piranha tries to find the operator for Expression it only finds the ones in piranha namespace and not in the global namespace.
Charles Chen
@chenchfort
Mar 10 2016 05:11
@isuruf For add_uni_poly, currently it works when either has an empty dictionary, but not when both are empty.
So I think that’s the only case needed to check.
Isuru Fernando
@isuruf
Mar 10 2016 05:15
And it doesn't throw an error when the variables are different
Charles Chen
@chenchfort
Mar 10 2016 05:15
Variables are different?
Isuru Fernando
@isuruf
Mar 10 2016 05:16
(x**2+x) + (y**2+y)
Charles Chen
@chenchfort
Mar 10 2016 05:17
Yes it works with different symbols.
One of the test case has a polynomial coefficent a and another one with b and it’s able to resolve to a+b
Oh wait, variables? But this is univariate
Ok I guess that needs to be checked
How should the error be thrown? Is there a standard way here?
Isuru Fernando
@isuruf
Mar 10 2016 05:20
throw an std::runtime_error with an appropriate error message
Charles Chen
@chenchfort
Mar 10 2016 05:46
Ok. Can you take a look?
Isuru Fernando
@isuruf
Mar 10 2016 05:49

https://github.com/symengine/symengine/pull/857/files#diff-24b25e13254d2ee9c30c9de4b209fcc8R467

a.get_var() == "" and b.get_var() == "x" will throw an error right?

Charles Chen
@chenchfort
Mar 10 2016 05:50
Let me test.
Yes, adding a and b would throw the error I indicated.
Charles Chen
@chenchfort
Mar 10 2016 06:15
Anything else?
Charles Chen
@chenchfort
Mar 10 2016 06:34
Used in line 65 of printer.h
Modify that line so it would not involve that operator?
Isuru Fernando
@isuruf
Mar 10 2016 06:42
Yeah
Charles Chen
@chenchfort
Mar 10 2016 07:27
Alright I’ve updated.
Isuru Fernando
@isuruf
Mar 10 2016 12:32
Issue about empty var poly and another poly is still there
Francesco Biscani
@bluescarni
Mar 10 2016 13:11
@isuruf IMO the best way of defining operator overloads is via inline friend functions
what kind of problem are you encountering precisely?
Isuru Fernando
@isuruf
Mar 10 2016 13:12
For std::map with user defined types?
Francesco Biscani
@bluescarni
Mar 10 2016 13:12
ah I thought this was the stream operator of a symengine type
Isuru Fernando
@isuruf
Mar 10 2016 13:12
Both
Francesco Biscani
@bluescarni
Mar 10 2016 13:13
mh for std::map I am not sure.. you are not supposed to put stuff in std so ADL seems out of the question
what kind of piranha operator is interfering?
Isuru Fernando
@isuruf
Mar 10 2016 13:14
I moved everything in to SymEngine namespace and it's working fine now
Non-friend non-member functions
Francesco Biscani
@bluescarni
Mar 10 2016 13:15
so you have something like:
namespace symengine
{
std::ostream &operator<<(std::ostream &, const T &)
{
}

}
Isuru Fernando
@isuruf
Mar 10 2016 13:15
Yes
Francesco Biscani
@bluescarni
Mar 10 2016 13:16
and this works when T is an std::map?
Isuru Fernando
@isuruf
Mar 10 2016 13:16
yes
Francesco Biscani
@bluescarni
Mar 10 2016 13:16
without using namespace symengine or similar statement? I would expect it to work only if you call it from within the symengine namespace
Isuru Fernando
@isuruf
Mar 10 2016 13:17
Hmm, I didn't check.
Francesco Biscani
@bluescarni
Mar 10 2016 13:22
I am curious about the problem you encountered with Piranha's operators though
because as far as I remember I am not overloading any stream op for std types
and all stream operators should be defined as friend inline functions
so they should be picked up only when invoked on piranha types
Isuru Fernando
@isuruf
Mar 10 2016 13:23
That's not it. It didn't find the operator for SymEngine::Expression when I moved it to the global namespace
Francesco Biscani
@bluescarni
Mar 10 2016 13:23
Since Test is within namespace B the compile sees the operator in that namespace and notes that it doesn't have a matching signature. It also attempts to find the operator in namespace A which contains the class but can't find it there either. Because there's already such an operator (with the wrong signature) in namespace B it won't go and attempt to find one at global scope.
Isuru Fernando
@isuruf
Mar 10 2016 13:25
Yes, that's the reason
Only in gcc and MSVC though. No problem in clang
Francesco Biscani
@bluescarni
Mar 10 2016 13:25
so maybe there are operators overloaded in the symengine namespace and those do not match Expression
right that sounds a bit weird
what happens if you move the overloaded operator as friend inline of Expression?
Isuru Fernando
@isuruf
Mar 10 2016 13:26
With piranha case, there were operators in piranha namespace, but Expression's operator was in global scope
Francesco Biscani
@bluescarni
Mar 10 2016 13:27
are you sure they were operators in the namespace rather than as friend inline?
Isuru Fernando
@isuruf
Mar 10 2016 13:27
Yes, in global namespace
Francesco Biscani
@bluescarni
Mar 10 2016 13:28
do you have any pointer? if it's true I need to fix that
Isuru Fernando
@isuruf
Mar 10 2016 13:28
There's nothing wrong in piranha. SymEngine's operator was in global namespace
Francesco Biscani
@bluescarni
Mar 10 2016 13:29
ah ok sorry, I misunderstood that
Akash Trehan
@CodeMaxx
Mar 10 2016 14:42
@isuruf Any more changes required for quadratic resides?
Charles Chen
@chenchfort
Mar 10 2016 16:15
What should happen when a polynomial has empty var?
Akash Trehan
@CodeMaxx
Mar 10 2016 16:48
I installed arb but cmake is not detecting it. Any idea why?
Isuru Fernando
@isuruf
Mar 10 2016 17:16
@chenchfort, just add the two polynomial normally, but the var of the new polynomial should be the non empty var
Charles Chen
@chenchfort
Mar 10 2016 17:29
@isuruf What if both are empty var?
Isuru Fernando
@isuruf
Mar 10 2016 17:29
Then a new polynomial with empty var
We should also add a check in is_canonical to check if var is empty, then dict size is 0 or 1 and if 1, then it is a constant poly.
Charles Chen
@chenchfort
Mar 10 2016 17:32
Ok I’ll try doing that.
What if var is empty and dict size is more than 1?
Isuru Fernando
@isuruf
Mar 10 2016 17:34
That's not possible right?
Charles Chen
@chenchfort
Mar 10 2016 17:34
What if the user enters that?
Isuru Fernando
@isuruf
Mar 10 2016 17:35
Then is_canonical should return false, which will throw an error in debug mode
false
parthparashar1647
@parthparashar1647
Mar 10 2016 20:55
want to discuss abt project improve python wrapper,started working on bot sage and sympy and understanding tools