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

Refinement level h #19

Open
lizrmn opened this issue Jul 21, 2021 · 4 comments
Open

Refinement level h #19

lizrmn opened this issue Jul 21, 2021 · 4 comments

Comments

@lizrmn
Copy link

lizrmn commented Jul 21, 2021

Hi @ddemidov,
I would love to know if there is a possibility to set the refinement parameter h in this code (regarding the python implementation)?
I get slightly different results comparing the MBA package in R (provided from SINTEF) and yours.

@ddemidov
Copy link
Owner

There is the tol parameter that specifies the target relative approximation error (||mba(x_i) - z_i|| / ||z||):

mba/mba/mba.hpp

Line 721 in 420bc7f

unsigned max_levels = 8, double tol = 1e-8, double min_fill = 0.5,

The parameter is also exposed to the python wrapper:

double tol = 1e-8,

so you can do something like

interp = mba2(..., tol=1e-12)

Re differences with the SINTEF version, I am not familiar with the implementation, so can not comment on the possible reason.
If I had to guess, I would say there are probably some minor details, like initial grid size, and what is exactly meant by the grid size in each implementation (for example, number of cells vs number of points).

@lizrmn
Copy link
Author

lizrmn commented Jul 21, 2021

Thank you for your fast reply. This is what I was looking for.
But I won't help with the differences regarding the algorithm in R. But thanks for your input on that as well.

@ddemidov
Copy link
Owner

I have just tested the rygg1.dat example from SINTEF MBA, see results in the following notebook:
https://nbviewer.jupyter.org/gist/ddemidov/6fcd134909d674669f6dffc2066bf739

The test point (5,5) has a minor discrepancy, but the data points are interpolated within the required tolerance (1e-8 by default).

@ddemidov
Copy link
Owner

Note that python interface assumes that all input arrays have C-layout, hence the .copy() in cell [2] in the above notebook.

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

2 participants