These are chat archives for symengine/symengine

Aug 2016
Srajan Garg
Aug 09 2016 09:33
Can you give me some sample input outputs?
I think what you want can be achieved by using URatPoly. Though the exact function isn't there yet
@isuruf different compilers (may) have different ordering for a set_basic members right? How can I test printing for multivar polynomials, as the printing result becomes compiler dependent
Isuru Fernando
Aug 09 2016 09:48
@srajan, in the printer use a platform independent order. See Derivative or Add
Srajan Garg
Aug 09 2016 13:24
It looks like it should currently work in a platform independent way too

as we use

template <class M, typename C = std::less<typename M::key_type>>
std::vector<typename M::key_type> sorted_keys(const M &d)

to iterate over all the keys in the map, in a sorted order

Srajan Garg
Aug 09 2016 13:29
Another weird thing is that some print x**2*y and some y*x**2, even though we iterate over the ordered set of variables
for (auto it : x.vars_) {
    if (exps[i] != 0) {
The only difference I see is between RCPBasicKeyLess and RCPBasicKeyLessCmp (can you shed some light on this, and what parts of symengine will be platform dependent in general)
Srajan Garg
Aug 09 2016 13:42
Does std::less work alright for intger vectors?
Isuru Fernando
Aug 09 2016 13:56
Yes, std::less should work fine for integer vectors
x*y**2 and y*x**2 is probably due to the difference in the order of x and y in set_basic
Srajan Garg
Aug 09 2016 14:33
It's x**2*y and y*x**2
the corresponding powers are correct, the variables are ordered differently

This is what the MSVC gives

  "a*y**-1*x - 3 - b*x"
  "-3 + a*x*y**-1 - b*x"

Here the vectors in the map are not being iterated in the expected order

even though we use the standard std::less to sort the keys (the vectors) of the map