3from .utils_polynomials
import *
6def recons_g(massgrid, massbins, kpol, gij, j, x):
8 Function to reconstruct the approximation of g using the components gij and the Legendre polynomial basis
10 only for DG scheme k>0, piecewise polynomial approximation
14 massgrid : 1D array (dim = nbins+1), type -> float
15 grid of masses given borders value of mass bins
16 massbins : 1D array (dim = nbins), type -> float
17 arithmetic mean value of massgrid for each mass bins
18 kpol : scalar, type -> integer
19 degree of polynomials for approximation
20 gij : 2D array (dim = (nbins,kpol+1)), type -> float
21 components of g on the polynomial basis
22 j : scalar, type -> integer
23 index of the bin for reconstruction
24 x : scalar, type -> float
25 mass value to evaluate the reconstruction of g
30 res : scalar, type -> float
31 reconstruction of g evaluated at x
36 xij = 2.0 / (massgrid[j + 1] - massgrid[j]) * (x - massbins[j])
38 res = np.polynomial.legendre.legval(xij, gij[j])
40 res = np.polynomial.legendre.legval(xij, gij[j, :])