These are chat archives for bluescarni/piranha

4th
Dec 2016
Francesco Biscani
@bluescarni
Dec 04 2016 12:27
@isuruf I added an option in the piranha build system to disable the installation of the headers
when the msgpack recipe is in, we can then 1) remove the manual installation of msgpack from the piranha recipe 2) ditch the workaround of requiring an installation of piranha in the pyranha recipe
Isuru Fernando
@isuruf
Dec 04 2016 12:28
yes
Francesco Biscani
@bluescarni
Dec 04 2016 12:29
thanks for the help on the msgpack recipe btw
Isuru Fernando
@isuruf
Dec 04 2016 12:29
FYI, I recently added a recipe for scikit-build as well
np
Francesco Biscani
@bluescarni
Dec 04 2016 12:30
ok awesome! I haven't looked into that very much yet, but after the next piranha version is released (0.9) I'll probably do a whole cmake overhaul, and in the process I'll try to switch to scikit-build for pyranha
Isuru Fernando
@isuruf
Dec 04 2016 12:30
great
Francesco Biscani
@bluescarni
Dec 04 2016 12:31
I meant to ask about your llvm work... I read a bit about kaleidoscope, and following the tutorial so far. But for symengine you are not actually writing to string and then jit compiling right? you are writing directly LLVM IR representation?
Isuru Fernando
@isuruf
Dec 04 2016 12:31
yes
Francesco Biscani
@bluescarni
Dec 04 2016 12:32
ok, so probably there's no need to spend much time on the tokenization/parsing part of the tutorial I imagine
Isuru Fernando
@isuruf
Dec 04 2016 12:33
yes. I skipped that part myself
Francesco Biscani
@bluescarni
Dec 04 2016 12:33
ok cool, thanks!
Isuru Fernando
@isuruf
Dec 04 2016 12:34
Are you looking into doing multiple polynomials at a time or just one at a time?
Francesco Biscani
@bluescarni
Dec 04 2016 12:35
you mean, to convert to IR representation multiple polynomials at a time?
I was looking at this paper for poly evaluation: https://arxiv.org/pdf/1207.7079.pdf
the basic idea is that multivariate horner schemes work well in conjunction with CSE
Isuru Fernando
@isuruf
Dec 04 2016 12:38
I meant evaluating multiple polynomials at a time. If you have multiple polys, cse will be very useful
Francesco Biscani
@bluescarni
Dec 04 2016 12:39
ah ok. I haven't looked into that specifically, but there are situations in which there are multiple polys to be evaluated at the same time, for instance in Fourier series over polynomial coefficients
brb
Francesco Biscani
@bluescarni
Dec 04 2016 12:49
what I mean is that the need arises to evaluate something like: (x+y)cosα+x3sinβ(x + y)\cos \alpha + x^3 \sin\beta
so in that case one has to evaluate multiple poly coefficients as part of the same expression
but in any case the expression would be written once as a LLVM function
the paper I linked seems to imply that one can rewrite multivariate polynomials as univariate polys recursively, and that is good for CSE
the paper itself deals with heuristics to find the "optimal" order in which to consider variables when doing the univariate horner recursion
I still need to wrap my head around how to make all this sufficiently generic
Isuru Fernando
@isuruf
Dec 04 2016 12:53
How does piranha represent things like sin(beta)
Francesco Biscani
@bluescarni
Dec 04 2016 12:54
you can in general consider objects such as sin(n0x0+n1x1+)\sin\left( n_0x_0+n_1x_1+\ldots\right) (for niZn_i \in \mathbb{Z}) as monomials
in the sense that they follow similar rules when doing multiplication for instance
they are sometimes called "trigonometric monomials"
so a Fourier series of the type (x+y)cosα+x3sinβ(x + y)\cos \alpha + x^3 \sin\beta looks and feels much like a "trigonometric polynomial" in which the coefficients are regular polynomials
indeed in piranha much code is shared between the representation of polynomials and Fourier series
Isuru Fernando
@isuruf
Dec 04 2016 12:58
Got it
Francesco Biscani
@bluescarni
Dec 04 2016 13:00
it makes even more sense if you move in the complex Fourier series domain, where you would have something like: (x+y)eıα+x3eıβ(x + y)\mathrm{e}^{\imath \alpha} + x^3 \mathrm{e}^{\imath \beta}
Isuru Fernando
@isuruf
Dec 04 2016 13:01
Right, then it is a polynomial of x, y and exp(i*alpha)
Francesco Biscani
@bluescarni
Dec 04 2016 13:02
in that case the correspondence is even more close, because the multiplication formula is the same: eıαeıβ=eı(α+β)\mathrm{e}^{\imath \alpha} \cdot \mathrm{e}^{\imath \beta} = \mathrm{e}^{\imath \left(\alpha + \beta \right)}
exactly yeah
indeed you can do all your operations considering the whole thing a polynomial, from the mathematical point of view
from the physical point of view you still want to maintain some distinction, as the complex exponential variables are related to periodic phenomena and you want to group them together