Cuba.jl icon indicating copy to clipboard operation
Cuba.jl copied to clipboard

Regions -> True inside Cuba.jl?

Open improbable-22 opened this issue 6 years ago • 3 comments

In the Mathematica interface to Cuba, I can obtain a list of the regions used by option Regions -> True. Is there any way to get this information in Julia?

After skimming the web page, it's unclear to me whether the C++ library exports this data, so perhaps this cannot be done.

improbable-22 avatar Jul 19 '17 17:07 improbable-22

I don't think this feature is exposed by the C library in the same way it is in Mathematica. A possibility is to use verbosity, this prints to screen many additional information including the list of subregions (but this is lee handy than what you're asking for). For example:

julia> cuhre((x, f) -> f[1] = cos(x[1]), flags = 3)
Cuhre input parameters:
  ndim 2
  ncomp 1
  nvec 1
  epsrel 0.0001
  epsabs 1e-12
  flags 3
  mineval 0
  maxeval 1000000
  key 0
  statefile ""

Region (0.000000) - (1.000000)
       (0.000000) - (1.000000)
[1] 0.841471 +- 2.22045e-16

Iteration 1:  65 integrand evaluations so far
[1] 0.841471 +- 2.22045e-16     chisq 0 (0 df)

Region (0.000000) - (0.500000)
       (0.000000) - (1.000000)
[1] 0.479426 +- 1.56691e-12

Region (0.500000) - (1.000000)
       (0.000000) - (1.000000)
[1] 0.362045 +- 1.1831e-12

Iteration 2:  195 integrand evaluations so far
[1] 0.841471 +- 2.22045e-16     chisq 1.86265e-09 (1 df)
Component:
 1: 0.8414709848078966 ± 2.2204460420128823e-16 (prob.: 3.443539937576958e-5)
Integrand evaluations: 195
Fail:                  0
Number of subregions:  2

giordano avatar Jul 19 '17 18:07 giordano

Thanks, I would not have thought of that.

Will experiment a bit...

improbable-22 avatar Jul 19 '17 19:07 improbable-22

In addition, Cuba library comes with a tool called partview which allows visualizing the tessellation. You can run a Julia script with verbosity = 3 from the command line and pipe the output to partview.

giordano avatar Jul 19 '17 23:07 giordano