These are chat archives for symengine/symengine

10th
May 2016
Iris Lui
@irislq
May 10 2016 01:37 UTC
@isuruf Sorry for this late response; I know I've been gone for some time. Based on your response about having UnivariateExprPolynomial containing the dictionary and UnivariatePolynomial wrapping around UnivariateExprPolynomial, does this mean all the operators like operator+ need to be from UnivariatePolynomial?
Isuru Fernando
@isuruf
May 10 2016 02:08 UTC
@irislq, no, operators should be in UnivariateExprPolynomial
But in place operators like += and -= should be written so that there is not extra allocation
Iris Lui
@irislq
May 10 2016 03:19 UTC
@isuruf What do you mean?
myluszczak
@myluszczak
May 10 2016 03:34 UTC
This message was deleted
Iris Lui
@irislq
May 10 2016 03:35 UTC
@shivamvats
myluszczak
@myluszczak
May 10 2016 03:35 UTC
@shivamvats @irislq @chenchfort @StoicBronco Iris said we'd be meeting here?
Iris Lui
@irislq
May 10 2016 03:35 UTC
This message was deleted
Shivam Vats
@shivamvats
May 10 2016 03:35 UTC
Hi guys
myluszczak
@myluszczak
May 10 2016 03:35 UTC
Which one is wrong?
Iris Lui
@irislq
May 10 2016 03:35 UTC
Ignore that
myluszczak
@myluszczak
May 10 2016 03:36 UTC
Hi shivam.
Iris Lui
@irislq
May 10 2016 03:36 UTC
Hi!
Shivam Vats
@shivamvats
May 10 2016 03:36 UTC
Hi
Is everyone here?
Iris Lui
@irislq
May 10 2016 03:36 UTC
Charles is on Slack, James is MIA
Shivam Vats
@shivamvats
May 10 2016 03:38 UTC
Could Charles join us here?
myluszczak
@myluszczak
May 10 2016 03:38 UTC
I left a message in slack, Charles hasn't responded yet.
Iris Lui
@irislq
May 10 2016 03:38 UTC
I dont know if he's actually online, he's not responsive @chenchfort
myluszczak
@myluszczak
May 10 2016 03:39 UTC
He might just have it open; he tends to keep a lot of tabs open
Shivam Vats
@shivamvats
May 10 2016 03:40 UTC
Let us begin then.
He can join when he does
Iris Lui
@irislq
May 10 2016 03:40 UTC
Sure
Shivam Vats
@shivamvats
May 10 2016 03:41 UTC
I have been travelling for the past few days so I couldn't see what optimisations you did.
In univariate
Iris Lui
@irislq
May 10 2016 03:42 UTC
On the Univariate side, we're still trying out FFT. Charles has been working heavily on the FFT multiplication, it's still a work in progress from what I've seen a couple of days. We haven't actually pushed a PR or anything because it's still experimental and we aren't sure if it'll actually make things faster

Also, I havent done much this week because of schoolwork, but I was going to do what Isuru suggested about this, and Im starting to ask about this:

@isuruf Sorry for this late response; I know I've been gone for some time. Based on your response about having UnivariateExprPolynomial containing the dictionary and UnivariatePolynomial wrapping around UnivariateExprPolynomial, does this mean all the operators like operator+ need to be from UnivariatePolynomial?

Shivam Vats
@shivamvats
May 10 2016 03:44 UTC
Oh! I was expecting more progress on this as I do not have high hopes on fft.
myluszczak
@myluszczak
May 10 2016 03:44 UTC
I talked with Charles on Saturday
Iris Lui
@irislq
May 10 2016 03:44 UTC
Im sorry I havent pulling my own weight recently :/
Shivam Vats
@shivamvats
May 10 2016 03:44 UTC
Fft will improve only very large multiplication whereas all our operations are slow I think.
myluszczak
@myluszczak
May 10 2016 03:45 UTC
He said that he had gotten about a factor of two or three improvement in speed with an optimized implementation but that inverse FFT was not giving the correct output
Shivam Vats
@shivamvats
May 10 2016 03:45 UTC
Yes, an optimised fft is tricky to implement.
@irislq
Iris Lui
@irislq
May 10 2016 03:46 UTC
Oh, I see
So should we not work with FFT?
Shivam Vats
@shivamvats
May 10 2016 03:46 UTC
Do not fret. We still have time.
Charles Chen
@chenchfort
May 10 2016 03:47 UTC
Hey guys, FFT is working. But the tricky part is to deal with different types of Expression.
Shivam Vats
@shivamvats
May 10 2016 03:47 UTC
No point leaing it mid way now.
Iris Lui
@irislq
May 10 2016 03:47 UTC
Well, I'll definitely see what I can do about modifying UnivariatePolynomial and UnivariateExprPolynomial and see if that will help the performance
Shivam Vats
@shivamvats
May 10 2016 03:47 UTC
Glad to hear!
Iris Lui
@irislq
May 10 2016 03:47 UTC
Oh hi Charles :D
Charles Chen
@chenchfort
May 10 2016 03:48 UTC
I have it as #931
Shivam Vats
@shivamvats
May 10 2016 03:48 UTC
Perhaps @chenchfort can finish fft and then help @irislq with mutability.
Iris Lui
@irislq
May 10 2016 03:48 UTC
Sounds good. I'll do my best on my end
Shivam Vats
@shivamvats
May 10 2016 03:48 UTC
Nice to hear :)
Charles Chen
@chenchfort
May 10 2016 03:49 UTC
So so far, the math is working correctly and it halves the time of the naive implementation.
Shivam Vats
@shivamvats
May 10 2016 03:50 UTC
One option is to have it for certain special cases.
Or types
Iris Lui
@irislq
May 10 2016 03:50 UTC
What would the FFT do in the case of symbolic coefficients?
Charles Chen
@chenchfort
May 10 2016 03:50 UTC
@myluszczak I only have 9 tabs...
Shivam Vats
@shivamvats
May 10 2016 03:51 UTC
Haha
myluszczak
@myluszczak
May 10 2016 03:51 UTC
@irislq I think it should just preform the computation symbolically
That would be pretty slow, though.
Shivam Vats
@shivamvats
May 10 2016 03:52 UTC
I think we should do fft for int and float.
First
And figure out the rest later.
Iris Lui
@irislq
May 10 2016 03:53 UTC
Sounds good for now, to me
Shivam Vats
@shivamvats
May 10 2016 03:53 UTC
How much time will it take @chenchfort ?
Charles Chen
@chenchfort
May 10 2016 03:53 UTC
For?
Shivam Vats
@shivamvats
May 10 2016 03:54 UTC
Fft for int and reals
Iris Lui
@irislq
May 10 2016 03:55 UTC
It sounds like he's almost done if he's just debugging for correctness
Charles Chen
@chenchfort
May 10 2016 03:55 UTC
So assuming all Expression coefficients are int?
Isuru Fernando
@isuruf
May 10 2016 03:55 UTC
I thought this was implemented in #931 ?
What would happen if the coefficients are symbolic? Wouldn't it still work?
Charles Chen
@chenchfort
May 10 2016 03:56 UTC
It would not work. So right now when doing FFT it would convert those integers to real_doubles
Iris Lui
@irislq
May 10 2016 03:58 UTC
@isuruf Charles is still trying to fix it to work with all the tests (from what I understand)
Charles Chen
@chenchfort
May 10 2016 03:58 UTC
Basically all coefficents would need to be converted to real_double at some point to do the computation.
Iris Lui
@irislq
May 10 2016 03:59 UTC
@chenchfort Can this be changed or is it strictly that all coefficients need to be doubles for FFT?
Charles Chen
@chenchfort
May 10 2016 03:59 UTC
We’ll need to figure it out.
myluszczak
@myluszczak
May 10 2016 03:59 UTC
It's cetainly not a mathematical requirement
Charles Chen
@chenchfort
May 10 2016 03:59 UTC
Yet preserving that O(nlogn)
Iris Lui
@irislq
May 10 2016 03:59 UTC
Alright, I can help with that if needed
myluszczak
@myluszczak
May 10 2016 04:00 UTC
All you need for FFT is addition and multiplication with complex numbers
Iris Lui
@irislq
May 10 2016 04:00 UTC
Is that line 91 and the other?
Isuru Fernando
@isuruf
May 10 2016 04:01 UTC
Expression thetaT = Expression(pi) / N;
base phiT(cos(thetaT), sin(thetaT))
Yes
Shivam Vats
@shivamvats
May 10 2016 04:01 UTC
@isuruf Other than fft and making the objects mutable, do you have anything in mind?
For improving speed
Charles Chen
@chenchfort
May 10 2016 04:02 UTC
I’ve tried porting flint’s implementation
I will push those branches soon.
Shivam Vats
@shivamvats
May 10 2016 04:02 UTC
Excellent!
Isuru Fernando
@isuruf
May 10 2016 04:02 UTC
No, I don't have any suggestions other than that
Btw, you should focus on getting polynomials with Expression coefficient to be as fast as possible.
Focusing on polynomials with integer coefficients is not really necessary
Charles Chen
@chenchfort
May 10 2016 04:04 UTC
Yes.
Iris Lui
@irislq
May 10 2016 04:04 UTC
Alright
Shivam Vats
@shivamvats
May 10 2016 04:05 UTC
Series expansion mostly uses rationals, right?
Charles Chen
@chenchfort
May 10 2016 04:05 UTC
Shouldn’t it be symbols since it’s called SymEngine haha.
Shivam Vats
@shivamvats
May 10 2016 04:05 UTC
In Sympy
We are able to do that without using Expressions.
myluszczak
@myluszczak
May 10 2016 04:06 UTC
The current MultivariateSeries implementation uses Expression coefficients.
Shivam Vats
@shivamvats
May 10 2016 04:07 UTC
Using ring, you can add a fixed number of variables which makes it faster than going fully symbolic/Ezpression.
Iris Lui
@irislq
May 10 2016 04:07 UTC
Do we have anything like that in SymEngine? I don't think we do
Shivam Vats
@shivamvats
May 10 2016 04:07 UTC
But that of course is not here in Symengine.
Yes
That could be a long term goal(porting ring) but lets focua on Expressions now as Isuru said.
myluszczak
@myluszczak
May 10 2016 04:09 UTC
Based on benchmarks done on PR924 the speed is faster when you have polynomials of the same variables. Rewriting the class to only work with specific variables would be faster.
Isuru Fernando
@isuruf
May 10 2016 04:09 UTC
Yes, the benchmarks we have uses rationals, but there needs to be a Expressions. Polynomials like x**2 + y**2 and x**2 + sin(y)**2 are the same in my mind. It's just a matter of using generators, but x**2 + sin(1)**2 is a totallly different thing.
myluszczak
@myluszczak
May 10 2016 04:10 UTC
Also, Expression coefficients allow us to do multivariate Taylor series expansion by using univariable series expansion on each coefficient.
Shivam Vats
@shivamvats
May 10 2016 04:10 UTC
One could consider sin(1) to be a generator too.
As long as we take it to be a symbolic object.
Isuru Fernando
@isuruf
May 10 2016 04:12 UTC
If you do that series expansion of cos(x**2 + sin(1)**2) becomes needlessly complicated
Charles Chen
@chenchfort
May 10 2016 04:13 UTC
For cos and sin, use SymEngine’s right?
Isuru Fernando
@isuruf
May 10 2016 04:13 UTC
yes
Shivam Vats
@shivamvats
May 10 2016 04:14 UTC
I can't see why. Is one is expanding wrt a variable
Wait
Srajan Garg
@srajangarg
May 10 2016 04:14 UTC
This message was deleted
Shivam Vats
@shivamvats
May 10 2016 04:14 UTC
Are you talking abt multivariate expansion?
Isuru Fernando
@isuruf
May 10 2016 04:14 UTC
Yes
Srajan Garg
@srajangarg
May 10 2016 04:14 UTC
This message was deleted
Shivam Vats
@shivamvats
May 10 2016 04:15 UTC
Oh! I was thinking of the univariate case.
StoicBronco
@StoicBronco
May 10 2016 04:15 UTC
hi shivam sorry im late :x:
Srajan Garg
@srajangarg
May 10 2016 04:16 UTC

@myluszczak Were you talking in terms of the problem of the "" (empty) var in the Univariate case? And what do you mean by this

Perhaps you could return whatever the coefficient type is when you get a constant polynomial, and overload all of the operations appropriately?

Charles Chen
@chenchfort
May 10 2016 04:18 UTC
Wait, @isuruf I was talking about this base phiT(cos(thetaT), sin(thetaT))
Shivam Vats
@shivamvats
May 10 2016 04:19 UTC
Hi @StoicBronco
StoicBronco
@StoicBronco
May 10 2016 04:19 UTC
hello
Isuru Fernando
@isuruf
May 10 2016 04:19 UTC
@chenchfort, yes sin and cos should be SymEngine ones
Charles Chen
@chenchfort
May 10 2016 04:19 UTC
Ok, thanks!
myluszczak
@myluszczak
May 10 2016 04:19 UTC
@srajangarg My impression was that the idea of having the variable "" in the univariate case was to allow the addition of a constant polynomial to any other polynomial. This would be another way of accomplishing the same thing: Whenever you find that you would be returning a constant polynomial, just return that constant and define your operations to work with that
@srajangarg with function overloading.
Srajan Garg
@srajangarg
May 10 2016 04:21 UTC
You mean to say, a different class for constants?
which will have overloaded functions like add_poly?
myluszczak
@myluszczak
May 10 2016 04:22 UTC
@srajangarg Well, whatever class you're using for coefficients
Srajan Garg
@srajangarg
May 10 2016 04:23 UTC
Hmm, makes sense. Will have to thing about it. But I feel this will kind of increase our work a lot.
Isuru Fernando
@isuruf
May 10 2016 04:23 UTC
@myluszczak, that will lose the information that the coefficient is an actual polynomial and then you cannot return it from a function returning a polynomial instance
Srajan Garg
@srajangarg
May 10 2016 04:23 UTC
And the fact that a constant is a polynomial too, semantically loses value
Yes
Iris Lui
@irislq
May 10 2016 04:25 UTC
So should the way the current polynomial class handles constant change?
Srajan Garg
@srajangarg
May 10 2016 04:25 UTC
We need a solution like the set way in Multivariate case. How about maintaining a set here too, but limit it's size to only 0 or 1?
myluszczak
@myluszczak
May 10 2016 04:25 UTC
It may not be a good idea. Is a similar consideration why SeriesBase inherits from Number?
Srajan Garg
@srajangarg
May 10 2016 04:25 UTC
@irislq It need not right now, but we are thinking of improving it
Isuru Fernando
@isuruf
May 10 2016 04:26 UTC
SeriesBase inheriting from Number is a hack, that will be fixed
Charles Chen
@chenchfort
May 10 2016 04:28 UTC
Anything we want to talk about?
*Anything else
StoicBronco
@StoicBronco
May 10 2016 04:28 UTC
matt, have you bugged anyone about the PRs yet
/ have we been told we need to change things
Iris Lui
@irislq
May 10 2016 04:28 UTC
Ah that reminds me, Matthew have any of the Multivariate PRs been handled yet?
myluszczak
@myluszczak
May 10 2016 04:28 UTC
@srajangarg If you use a set in the Univariable case, would it make sense to have a single polynomial object with different behavior based on the size of the set? I think Shivam has floated merging the classes together.
@srajangarg has been reviewing PR924
Isuru Fernando
@isuruf
May 10 2016 04:29 UTC
About #924, can you explain a little bit about what some of the functions do? See https://github.com/symengine/symengine/pull/924#discussion_r62145355
myluszczak
@myluszczak
May 10 2016 04:30 UTC
In is_cannonical, or more generally?
Wait, that
's in from_dict.
from_dict takes a set_sym and a dictionary and returns a polynomial in cannonical form
Isuru Fernando
@isuruf
May 10 2016 04:32 UTC
I don't have the time to look into literature this week, so I'll need some comments about what you have done. If you could start with it, I'll ask some more questions to get familiart with it
myluszczak
@myluszczak
May 10 2016 04:32 UTC
All right.
I'll add some comments tonight.
Is from_dict the only major area of confusion, or do you want me to comment more liberally generally.
?
Shivam Vats
@shivamvats
May 10 2016 04:33 UTC
@chenchfort @irislq I dont have anything to add. This week's goals should be clear.
Isuru Fernando
@isuruf
May 10 2016 04:33 UTC
MultivariateIntPolynomial::from_dict({y, z}, {{{2, 1}, -2_z}, {{0, 2}, 1_z}, {{1, 0}, 3_z}});
In the above, what if set_sym orders {y, z} to {z, y} ?
Charles Chen
@chenchfort
May 10 2016 04:33 UTC
When shall we meet again.
Iris Lui
@irislq
May 10 2016 04:33 UTC
@shivamvats I dont have anything else either
myluszczak
@myluszczak
May 10 2016 04:33 UTC
@isuruf std::set is an ordered container.
Iris Lui
@irislq
May 10 2016 04:34 UTC
Right, is next week going to be back to our normal schedule?
StoicBronco
@StoicBronco
May 10 2016 04:34 UTC
saturdays aren't looking good for me :/
Isuru Fernando
@isuruf
May 10 2016 04:34 UTC
Yes, but the order depends on a hash and the hash is dependent on compiler
Shivam Vats
@shivamvats
May 10 2016 04:34 UTC
Most probably. I will reach there on 13th.
Iris Lui
@irislq
May 10 2016 04:34 UTC
You have plans James?
StoicBronco
@StoicBronco
May 10 2016 04:34 UTC
sunday is the only real free day I have nowadays
Charles Chen
@chenchfort
May 10 2016 04:35 UTC
What about this friday
Shivam Vats
@shivamvats
May 10 2016 04:35 UTC
I will let you know the exact time after figuring out the time difference.
StoicBronco
@StoicBronco
May 10 2016 04:35 UTC
my fridays are spent in sasc
sac*
Isuru Fernando
@isuruf
May 10 2016 04:35 UTC
MultivariateIntPolynomial::from_dict({y, z}, {{{2, 1}, -2_z}, {{0, 2}, 1_z}, {{1, 0}, 3_z}}); is -2*y**2*z + z**2 + 3*y right?
What is MultivariateIntPolynomial::from_dict({z, y}, {{{2, 1}, -2_z}, {{0, 2}, 1_z}, {{1, 0}, 3_z}}); ?
Iris Lui
@irislq
May 10 2016 04:35 UTC
Oh right, Shivam are you going to be in the US this weekend?
Charles Chen
@chenchfort
May 10 2016 04:35 UTC
Thursday?
StoicBronco
@StoicBronco
May 10 2016 04:35 UTC
thursday im in san fran
Shivam Vats
@shivamvats
May 10 2016 04:35 UTC
Yes
myluszczak
@myluszczak
May 10 2016 04:35 UTC
I thought we could pass an order when defining the object--In dict.h I give it RCPSymbolCompare?
Charles Chen
@chenchfort
May 10 2016 04:35 UTC
But you can still get on a laptop
StoicBronco
@StoicBronco
May 10 2016 04:36 UTC
with what internet?
i don't live down there O.o
Isuru Fernando
@isuruf
May 10 2016 04:36 UTC
@myluszczak, ah okay.
Iris Lui
@irislq
May 10 2016 04:36 UTC
Ok, so how about Sunday like we usually do? You'll be on the same timezone as us
Isuru Fernando
@isuruf
May 10 2016 04:36 UTC
@myluszczak, @StoicBronco, see my comment here, https://gitter.im/symengine/symengine?at=573165101aac35a00e4ac2e2
myluszczak
@myluszczak
May 10 2016 04:36 UTC
@isuruf I assumed that It'd be the same.
But I haven't tested that.
StoicBronco
@StoicBronco
May 10 2016 04:37 UTC
likewise
the canonical form that from_dict uses normally works
but we haven't put testers for it as far as I know
ill add some testers when i can
Isuru Fernando
@isuruf
May 10 2016 04:37 UTC
I was expecting the second one to have y and z swapped
StoicBronco
@StoicBronco
May 10 2016 04:37 UTC
err, one moment
the powers would be swapped?
Iris Lui
@irislq
May 10 2016 04:38 UTC
@shivamvats
myluszczak
@myluszczak
May 10 2016 04:38 UTC
I don't think we tested that on purpose.
StoicBronco
@StoicBronco
May 10 2016 04:39 UTC
i imagine the powers are matched with the symbol before putting in canonical order
Shivam Vats
@shivamvats
May 10 2016 04:39 UTC
@irislq We could do that.
myluszczak
@myluszczak
May 10 2016 04:39 UTC
Looking at test_polynomial.cpp in branch mulexprpoly, I see a test for RCP<const MultivariatePolynomial> p2 = MultivariatePolynomial::from_dict(
{n, m}, {{{1, 0}, comp1}, {{2, -1}, comp4}});
and it seems to have worked out there
Isuru Fernando
@isuruf
May 10 2016 04:39 UTC
First one would give -2*y**2*z + z**2 + 3*y and I expect the second to give, -2*z**2*y + y**2 + 3*z. Is that what is happening?
Iris Lui
@irislq
May 10 2016 04:39 UTC
Alright great : )
myluszczak
@myluszczak
May 10 2016 04:39 UTC
But we haven't tested that deliberately.
I don't think so, no.
StoicBronco
@StoicBronco
May 10 2016 04:39 UTC
it should be yes..?
matt
he didn't swap the power's places
only the symbols
and i think
myluszczak
@myluszczak
May 10 2016 04:40 UTC
The correct behavior would be no, I'd think.
StoicBronco
@StoicBronco
May 10 2016 04:40 UTC
it would return
-2* y*z**2 + y**2 + 3*z
err
Iris Lui
@irislq
May 10 2016 04:41 UTC
I think you mean -2*y*z**2 + y**2 + 3*z right?
myluszczak
@myluszczak
May 10 2016 04:41 UTC
@irsuruf I believe that the current implementation will give the same polynomial in both cases.
StoicBronco
@StoicBronco
May 10 2016 04:41 UTC
with z instead of x
and a negative in front
how do i do that ?
Iris Lui
@irislq
May 10 2016 04:41 UTC
Changed
Use `
instead of quotations marks
myluszczak
@myluszczak
May 10 2016 04:41 UTC
set_sym should be ordered by RCPSymbolCompare
StoicBronco
@StoicBronco
May 10 2016 04:42 UTC
i see
myluszczak
@myluszczak
May 10 2016 04:42 UTC
@irislq which character is that?
StoicBronco
@StoicBronco
May 10 2016 04:42 UTC
the one on the same key as the tilde
~
except don't push shift
Iris Lui
@irislq
May 10 2016 04:42 UTC
What James said
myluszczak
@myluszczak
May 10 2016 04:43 UTC
@isuruf So I think the current implementation should return the same polynomial in both cases.
@irsuruf If you give me a few minutes I could test it.
StoicBronco
@StoicBronco
May 10 2016 04:44 UTC
MultivariateIntPolynomial::from_dict({z, y}, {{{2, 1}, -2_z}} would map 2 to y and 1 to z?
myluszczak
@myluszczak
May 10 2016 04:44 UTC
No, it would give -2 * y**2 z
I think]
StoicBronco
@StoicBronco
May 10 2016 04:45 UTC
so.. yes. 2 to y and 1 to z, aka y^2 and z
and i see
Isuru Fernando
@isuruf
May 10 2016 04:45 UTC
Let me look at how SymPy and piranha does multivariate polynomials
myluszczak
@myluszczak
May 10 2016 04:54 UTC
@isurf @StoicBronco Just tested it on CSIF, RCP<const MultivariateIntPolynomial> p1 = MultivariateIntPolynomial::from_dict({x,y}, { {{1,2},integer_class(1) } }); and RCP<const MultivariateIntPolynomial> p2 = MultivariateIntPolynomial::from_dict({y,x}, { {{1,2}, integer_class(1)} } ); both print as x y**2 and recognize each other as equal on calling p1->__eq__(*p2)
StoicBronco
@StoicBronco
May 10 2016 04:55 UTC
welp
myluszczak
@myluszczak
May 10 2016 04:56 UTC
We originally went with std::set because it is an ordered container, which could be used to define an order on the variables which would make comparisons between polynomials simpler.
Also when printing, for example, we could iterate through the set and iterate through the vec_uint's containing the exponents and know when exponent corresponded to which variable.
Isuru Fernando
@isuruf
May 10 2016 05:00 UTC
That's fine. I think you should make ::from_dict a private function and add public method that would use std::vectors and construct from them
myluszczak
@myluszczak
May 10 2016 05:02 UTC
Just to hold the symbols or to hold the information from the dictionary as well?
Isuru Fernando
@isuruf
May 10 2016 05:02 UTC
Just to hold the symbols
When converting to set_sym the dictionary would have to permuted as well
myluszczak
@myluszczak
May 10 2016 05:03 UTC
I see.
Isuru Fernando
@isuruf
May 10 2016 05:03 UTC
{y, x}, {{1, 2}, 3} -> {x, y}, {{2, 1}, 3}
myluszczak
@myluszczak
May 10 2016 05:04 UTC
For things like add_mult_poly and mul_mult_poly I'd like to avoid the extra overhead; but this could probably be accomplished by making them friend functions.
Isuru Fernando
@isuruf
May 10 2016 05:05 UTC
add_mul_poly wouldn't have to be changed at all
myluszczak
@myluszczak
May 10 2016 05:06 UTC
Currently it's not a member function, wouldn't it not have access to a private function?
Srajan Garg
@srajangarg
May 10 2016 05:06 UTC
@isuruf you mean the vectors (the individual keys) of the dictionaries?
And all such vectors will have to be permuted right?
myluszczak
@myluszczak
May 10 2016 05:07 UTC
@srajangarg That is what I understood.
Isuru Fernando
@isuruf
May 10 2016 05:10 UTC
@myluszczak, yes, those will have to be declared friend
Srajan Garg
@srajangarg
May 10 2016 05:13 UTC
@myluszczak How are you gonna achieve the permutation?
myluszczak
@myluszczak
May 10 2016 05:14 UTC
@srajangarg I already have a translate function which can permute the entries of a vector given a vector representing the permutation.
Charles Chen
@chenchfort
May 10 2016 05:15 UTC
@isuruf How do we round Real_double to Integer?
Srajan Garg
@srajangarg
May 10 2016 05:15 UTC
And how will the vector containing the permutation be built?
myluszczak
@myluszczak
May 10 2016 05:15 UTC
So far as calculating the vector, since we'll need to create the set anyways we could create the set from the vector and then iterate through the set to find each symbol's position in the set.
This message was deleted
There might be a better way, that's just off the top of my head.
myluszczak
@myluszczak
May 10 2016 05:22 UTC
So long as the number of variables is small doing linear search shouldn't matter too much.
Srajan Garg
@srajangarg
May 10 2016 05:22 UTC
How about this, create a map<symbol, vec_int, symbolcompare> for each symbol. So {y, x}, {{1, 2}, 3}, {{2, 5}, 4}, {{0, 2}, -1} will be represented as
x -> [2, 5, 2]
y -> [1, 2, 0]
coeffs -> [3, 4,-1]
and then, they will be stored in order in the map
and you can pickup the kth element from each vector (in order) to construct the original dictionary back
which will be what we desire
I think the "picking kth" part can be highly optimized too
myluszczak
@myluszczak
May 10 2016 05:27 UTC
I see.
Srajan Garg
@srajangarg
May 10 2016 05:27 UTC
So, the new dictionary will be {x, y}, {{2,1}, 3}, {{5,2}, 4}, {{2,0}, -1}
Isuru Fernando
@isuruf
May 10 2016 05:31 UTC
@chenchfort, in what kind of scenario? Ideally we would want to avoid double -> integer conversions
myluszczak
@myluszczak
May 10 2016 05:32 UTC
@srajangarg Could you elaborate on what you mean by the "picking kth" optimization?
Srajan Garg
@srajangarg
May 10 2016 05:33 UTC
Umm, it's off the top of my head but
Once the map is ordered, you just sort of convert the map into a 2D matrix
like above, and then each vector (key in original dict) is just a column in that matrix
StoicBronco
@StoicBronco
May 10 2016 05:35 UTC
@shivamvats sorry again for being late, and i got to go, talk to you next week
Srajan Garg
@srajangarg
May 10 2016 05:39 UTC
so the whole process takes O(m*n) time, where m is the number of vars, and n is the number of terms. This is basically I think the same amount of time that will be taken to permute too. (O(m) permutation time for each of the n vecors) But this ideas seems simpler I guess.
myluszczak
@myluszczak
May 10 2016 05:40 UTC
@srajangarg I can see how that would work. Thanks.
I'll implement it tomorrow, since it's getting late where I am.
Srajan Garg
@srajangarg
May 10 2016 05:41 UTC
Actually this uses extra O(m*n) space. Which is a waste. Your permutation methods seems better. You can construct the permutation using the same idea (use indexes for the variables in the map) and get the permutation vector. And then permute each dict key. Takes same time, and only O(m) space.
Charles Chen
@chenchfort
May 10 2016 05:42 UTC
@isuruf So pi and those trigs are invovled so I think that’s why coefficents are converted to double.
So I’m wondering if there’s a way for it to convert those coefficients to what type it’s supposed to be.
Srajan Garg
@srajangarg
May 10 2016 05:43 UTC

You can construct the permutation using the same idea (use indexes for the variables in the map)

I mean the map that we constructed additionally. So for {y, z, x} it would be y -> 0, z -> 1, x -> 2. And after iterating over this map you'll get the permutation vector [2,0,1]

myluszczak
@myluszczak
May 10 2016 05:44 UTC
Yes, that's faster than just iterating through the set and vector.
Srajan Garg
@srajangarg
May 10 2016 05:46 UTC
Yes, basically use the same idea, I just suggested a better way to construct the permutation vector I think . Silly me
myluszczak
@myluszczak
May 10 2016 05:47 UTC
No, no, this has been helpful.
I think I'm going to log off soon, to get some sleep. What time zone are you in?
Srajan Garg
@srajangarg
May 10 2016 05:48 UTC
IST, it's 11:30 AM same as Isuru's. Goodbye!
myluszczak
@myluszczak
May 10 2016 05:49 UTC
@srajangarg Thanks, I'll keep that in mind when contacting you. I'm on PST. Bye!
@shivamvats Quick update on Multivariable Series: Multivariable series now passes all tests when is_cannonical is commented out, but It only fails on one when is_cannonical is operative and I expect that the error should be easy to fix. I do not plan to submit a PR with this until the polynomial stuff dies down, but if you want to look at it its on branch mulseriesfour on my remote. I am logging off after this message.
Srajan Garg
@srajangarg
May 10 2016 08:37 UTC
@isuruf Why isn't Basic operator == overloaded? Is it because of performance reasons?
Francesco Biscani
@bluescarni
May 10 2016 09:08 UTC
the explanation in that document about the interaction between const correctness, performance and developer-friendliness does not make much sense in modern C++
Isuru Fernando
@isuruf
May 10 2016 09:09 UTC
You think we should define operator overloads for RCP?
Francesco Biscani
@bluescarni
May 10 2016 09:10 UTC
I agree on that part, in the sense that overloading operators for classes you have no full control on could be problematic
my comment was more in the general sentiment that (at least to me) seems implied by the document
that is that you have to trade off nice notation for performance
Isuru Fernando
@isuruf
May 10 2016 09:11 UTC
Right
Francesco Biscani
@bluescarni
May 10 2016 09:15 UTC
we had some discussions about this in the past (e.g., pointer semantics vs value semantics), and I understand that this is the path chosen by symengine and it's fine... I just wanted to point out that generally speaking in modern C++ you can have nice syntax and performance at the same time (and it's actually one of the main drivers of the evolution of the language over the last few years)
(and that it is not particularly hard)
Isuru Fernando
@isuruf
May 10 2016 09:18 UTC
Generally speaking it's not that easy. (Expression templates. :D) But I agree, it shouldn't be that hard.
Iris Lui
@irislq
May 10 2016 23:27 UTC
@isuruf Since UnivariatePolynomial will wrap around UnivariateExprPolynomial, does this mean that UnivariateSeries would now need to take in UnivariatePolynomial instead (or rather an RCP of it)?