JuliaMath / HCubature.jl

pure-Julia multidimensional h-adaptive integration
Other
153 stars 25 forks source link

Return internal information for future use #10

Open jwscook opened 6 years ago

jwscook commented 6 years ago

I'm currently doing a lot of cubature integrals, and it's quite slow due to the shear number of integrals. However, I suspect that the number of intervals and/or quadrature points at convergence are quite similar from one integral to another. Is there is an opportunity for speed up if this information can be passed from one cubature evaluation to another, so that the algorithm can start off from a better position?

Top work on this package btw!

stevengj commented 6 years ago

The best way to share points between similar integrals is probably to integrate a vector-valued integrand. (Use StaticArrays.jl for the integrand so that you don't need to allocate lots of temporary vectors on the heap.)

Also, I'm skeptical that the savings from saving/re-using cubature regions would be that great — because it's a geometric series of points, you waste at most a factor of two in the number of integrand evaluations during adaptivity.

jwscook commented 6 years ago

It's going to be quite a challenge to create a vector valued integrand because the integral bounds are different for each quantity that would be in the vector, or so it's been written. It's for a least squares finite element method where I'm integrating over the intersection of at least two multi-dimensional basis functions of compact supports. Also the problem isn't in general translationally invariant because of spatially dependent factors in the integrand.

I wasn't very clear before. When I said saving intervals, I meant it in a relative sense:

Let's say that in the course of the first integral over the interval [a,b), normalised to [-1, 1), there are N subdivisions e.g. [-1, -0.75), [-0.75, 0.25) [0.25, 0.5) and [0.25, 1). It is then possible to start with the same subdivision, relatively speaking, but over the interval of the next integral [a', b')?

I assume not because it sounds difficult.

jwscook commented 6 years ago

Also, a factor of 2 sounds good! I'll take what I can get.

stevengj commented 6 years ago

It is then possible to start with the same subdivision, relatively speaking, …

If that is what you want, you could use a vector-valued integrand with a coordinate transformation to map all of your integrands to the same domain.

jwscook commented 6 years ago

A coordinate transformation will be rather challenging because I'm working with non-orthogonal coordinate systems.

Having vectorised it, and storing the vector result with vector of inputs as a dictionary has made re-evaluations redundant.