dubourg / python-randomfields

A Python module that implements tools for the simulation and identification of random fields using the Karhunen-Loeve expansion representation.
19 stars 14 forks source link

Bugs for polynomial nodes #6

Open jinglunyao opened 7 years ago

jinglunyao commented 7 years ago

Hello,

I have tried to used the code for my database and it seems to me that there is an error relating to nodes of polynomials.

    U, W = polynoms.getNodesAndWeights(
        ot.Indices([legendre_quadrature_order] * dimension * 2))

would create nodes U independent of the domain of definition. Thus

    X = np.repeat(scale, 2) * U + np.repeat(shift, 2)

would create X which exceed the domain of definition. In consequence, we would get nan for matrix C.

Could you please try to fix this problem? Thank you in advance.

jinglunyao commented 7 years ago

Hello,

I think we should replace

X = np.repeat(scale, 2) * U + np.repeat(shift, 2)

by

    X = np.array(list(scale)* 2) * U + np.array(list(shift)*2)

Please check it this is correct.