Skip to content

Fix Bug #58

Damar Wicaksono requested to merge dev-58 into dev

This is the bug fix for Issue #58 (closed). There was apparently a problem in how the splits and related quantities are computed which breaks the DDS algorithm when the lp-degree is set to less than 1.0. In such case, the jumps in exponents are not correctly calculated.

I use this opportunity to propose a rewrite of the three related functions purely using NumPy: compile_splits, compile_subtree_sizes, and compile_problem_sizes. I did a benchmark similar to what @hernan68 did for generating exponents in the minterpy-benchmarks repo and compare the NumPy implementations against the current implementation with Numba. The results can be found here, here, and here.

As a summary:

  • For compile_splits and compile_subtree_sizes, Numba performs a bit faster for low dimension, low degree, and low lp-degree but NumPy performs a bit faster for higher dimension, degree, and lp-degree.
  • For compile_problem_sizes, Numba is consistently faster but this function is only used for dictionary-based transformation that is not used by default and, I guess, will not be very often called.
  • The output for all functions remain the same (a TYPED_LIST), while the input changes for compile_problem_sizes because only one input (the subtree sizes) turns out to be necessary instead of three to compute the sub-problem sizes in the multi-index tree.
  • In my opinion, the NumPy implementations are more concise and clearer in their intentions than multiple nested loops used in the Numba implementations. I guess this should be taken into account as well especially for non-performance sensitive functions such as these three functions. But please double check them again.

All the in-code documentation for the functions have been updated with examples. I also include lp-degree of less than 1.0 in the test configuration to cover this case.

Merge request reports

Loading