These are chat archives for symengine/symengine

24th
Jul 2015
Shivam Vats
@shivamvats
Jul 24 2015 01:53
Why does Rational::from_two_ints take RCP as argument while Complex::from_two_rats doesn't:
    static RCP<const Number> from_two_rats(const Rational &re,
        const Rational &im);
    static RCP<const Number> from_two_ints(const RCP<const Integer> &n,
            const RCP<const Integer> &d);
Sumith Kulal
@Sumith1896
Jul 24 2015 03:47
N
Sumith Kulal
@Sumith1896
Jul 24 2015 06:07
Sorry, whenever I check in mobile, something gets in :smile:
@certik Should I change it throughout SymEngine?
Shivam Vats
@shivamvats
Jul 24 2015 13:48
ping @Sumith1896
Sumith Kulal
@Sumith1896
Jul 24 2015 14:25
Hi @shivamvats
Shivam Vats
@shivamvats
Jul 24 2015 14:28
How do you calculate the hash of the sum of two polys?
Sumith Kulal
@Sumith1896
Jul 24 2015 14:29
I think I am not understanding you.
There is __hash__ and add_poly two separate methods
Shivam Vats
@shivamvats
Jul 24 2015 14:32
Yes, but you were worried about the hash of two polys (with same tuples but different variables) being same, weren't you?
Sumith Kulal
@Sumith1896
Jul 24 2015 14:34
Take an example:
{x, y, z} poly mul with {x, y, z}
{x, y, z} poly mul with {p, q, r}
Here the mul routine that takes in Polynomial should have more checks
Our previous routine used to take in hash_set
Shivam Vats
@shivamvats
Jul 24 2015 14:40
Ok
We can have more checks. But I still dont understand why hash_set is problematic.
Sumith Kulal
@Sumith1896
Jul 24 2015 18:56
Yes, we need to discuss this
Shivam Vats
@shivamvats
Jul 24 2015 19:51
There?
Sumith Kulal
@Sumith1896
Jul 24 2015 19:53
Yes
Shivam Vats
@shivamvats
Jul 24 2015 19:53
Could you elaborate on the problem?
Sumith Kulal
@Sumith1896
Jul 24 2015 19:54
(typing)
The mul routine which we used for benchmarking, in that we didn't consider the fact that given a exponent vector, each element is mapped to a symbol
Sumith Kulal
@Sumith1896
Jul 24 2015 20:01
For example if there a exponent vector {1, 2, 3} of monomial x**1*y**2*z**3, and another is {2, 3, 4} but of p**2*q**3*r**4, then I suspect that the mul routine doesn't remain the same.
It may be assuming that the {2, 3, 4} still corresponds to x, y, z
cc @bluescarni
Shivam Vats
@shivamvats
Jul 24 2015 20:02
Can you give me the link to mul?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:10
Also, could we discuss the tasks in hand?
Shivam Vats
@shivamvats
Jul 24 2015 20:10
Ok, you mean mul will fail if we try something like (x*y**2*z**3)*(p*q**2*r**3)?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:10
Yes
Shivam Vats
@shivamvats
Jul 24 2015 20:14
Either we need to modify it to make sure it takes care of different variables or that we always multiply polys with same variables
Sumith Kulal
@Sumith1896
Jul 24 2015 20:14
We need to modify it, yes
Shivam Vats
@shivamvats
Jul 24 2015 20:15
Other than that, what remains to be done?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:15
mul is done, basic arith like add, sub, neg shouldn't take time
constructors are there, can be improved upon a lot
Shivam Vats
@shivamvats
Jul 24 2015 20:17
Let's finish your PR fast
Sumith Kulal
@Sumith1896
Jul 24 2015 20:17
Can we do it over this weekend?
Shivam Vats
@shivamvats
Jul 24 2015 20:17
Sure
Sumith Kulal
@Sumith1896
Jul 24 2015 20:18
Weekends, I get free a lot
Thanks
Shivam Vats
@shivamvats
Jul 24 2015 20:18
We can finish this fast and you can send a separate PR for other methods
That way we can work on PRs parallely
Sumith Kulal
@Sumith1896
Jul 24 2015 20:19
What do we want in this?
I think arithmetic methods except division should do
Shivam Vats
@shivamvats
Jul 24 2015 20:19
Ok
Sumith Kulal
@Sumith1896
Jul 24 2015 20:19
I think @certik was mentioning about replacing mpz_class by piranha::integerthroughout and testing benchmarks, I'll do that first in the morning tomorrow
Shivam Vats
@shivamvats
Jul 24 2015 20:20
What can I help with?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:21
The mul routine problem that we discussed
Shivam Vats
@shivamvats
Jul 24 2015 20:24
How does mul work?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:25
       temp.first = a.first + b.first;
       size_t bucket = C._bucket(temp);
       auto it = C._find(temp, bucket);

This finds if resulting hash_set has the same term in a iteration

           if (it == C.end()) { ...
               }

If present, it will insert and increase size

           } else {
               piranha::math::multiply_accumulate(it->second,a.second,b.second);
           }

else FMA

Shivam Vats
@shivamvats
Jul 24 2015 20:26
Yeah, I did see the code. But the use of buckets is not obvious
What algo are you using?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:28
Sorry, got sent in quickly
Let me know if it is fine
Shivam Vats
@shivamvats
Jul 24 2015 20:31
Cool
I'll go through it.
Sumith Kulal
@Sumith1896
Jul 24 2015 20:32
Okay, what do you plan ahead?
Shivam Vats
@shivamvats
Jul 24 2015 20:33
Once the basic arithmetic operations are done, the code structure won't change, will it?
I want to start implementing function expansions.
Sumith Kulal
@Sumith1896
Jul 24 2015 20:33
No, ideally shouldn't
Yes, it should work fine for that
Shivam Vats
@shivamvats
Jul 24 2015 20:34
Great
Sumith Kulal
@Sumith1896
Jul 24 2015 20:34
But amendments will be needed when you have to expand to other domains
Shivam Vats
@shivamvats
Jul 24 2015 20:34
Yes
Domain change will affect the hash-set , right?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:37
Yes, we'll need a different pair though
mutable Expression second
Also, I have to use std::unordered_set whenever Piranha dependency is not there
So that we have working code, just slower
Shivam Vats
@shivamvats
Jul 24 2015 20:39
Ok
We have only 3-4 weeks. Need to move fast.
Sumith Kulal
@Sumith1896
Jul 24 2015 20:40
Yes
Shivam Vats
@shivamvats
Jul 24 2015 20:40
Is there anything else to discuss?
Sumith Kulal
@Sumith1896
Jul 24 2015 20:42
Nothing now
Shivam Vats
@shivamvats
Jul 24 2015 20:42
Great!
Thank you for your time. :)
Sumith Kulal
@Sumith1896
Jul 24 2015 20:42
Thanks to you :smile:
Will catch you tomorrow
Shivam Vats
@shivamvats
Jul 24 2015 20:43
Sure
Sumith Kulal
@Sumith1896
Jul 24 2015 20:43
Let's get as much as possible done in the weekend
Shivam Vats
@shivamvats
Jul 24 2015 20:44
yes
Sumith Kulal
@Sumith1896
Jul 24 2015 20:45
Cool