Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

computeTensorizedSP #113

Open
vavrines opened this issue Jun 3, 2023 · 0 comments
Open

computeTensorizedSP #113

vavrines opened this issue Jun 3, 2023 · 0 comments

Comments

@vavrines
Copy link
Contributor

vavrines commented Jun 3, 2023

The computeTensorizedSP seems to drop entries less than 1E-10,
This is not very reasonable when using Float64 and can cause weird behaviors when making use of tensor products.

MWE

using PolyChaos

op = Uniform_11OrthoPoly(20, Nrec = 40)
t2 = Tensor(2, op)

l1 = [t2.get([i, i]) for i=0:op.deg]
l2 = computeSP2(op)

l1 is not equal to l2

julia> l1
21-element Vector{Float64}:
 ⋮
 3.6023076661943104e-10
 0.0
 0.0
 0.0
 0.0
julia> l2
21-element Vector{Float64}:
 ⋮
 3.6023076661943104e-10
 9.013566368226456e-11
 2.2551316627840712e-11
 5.64173617647297e-12
 1.4113161166911746e-12

computeTensorizedSP is the default method used to construct Tensor, see

tensorEntries = computeTensorizedSP(dim, opq)

In the following example, Tensor.get() would not work at high orders as the denominators are zero.

function ODEgalerkin(du,u,p,t)
   du[:] = [ sum( p[j+1]*u[k+1]*t3.get([j,k,m])/t2.get([m,m]) for j=0:L for k=0:L) for m=0:L ] 
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant