Skip to content
Snippets Groups Projects

add dynamic and static methods for factorials and binomials

Merged Janick Gerstenberger requested to merge feature/dynamic-static-factorial-binomial into master

Added some dynamic and static methods for calculating factorials and binomials. There are several different implementation in several modules of varying accessibility and age which can be replaced by this.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @carsten.graeser I had some problems with constexpr functions where the loop variable is supplied as an argument with gcc5 in the past. Also the range method is not declared constexpr (despite the constructor of the implementations being constexpr).

  • Replacing the use of range() by a plain good old for loop still seems to be a much better solution compared to those seven template specializations. I cannot see the loop variable passed as an argument anywhere.

  • I also vaguely remember that caching binomials gave a significant performance improvement in some applications. This is of course only possible for moderately sized arguments and would need some benchmarking.

  • I meant the loop bound not the loop variable. I will check if the simplified version works.

  • Janick Gerstenberger resolved all discussions

    resolved all discussions

  • @carsten.graeser Since the version you suggested works on all compilers that support a reasonable amount of c++14 I changed the implementation.

  • @janick.gerstenberger: The question is, if the list of those compilers is a superset of the compiler we support in master.

  • @carsten.graeser it works with gcc5+, clang3.5+. icc18.0 appears to work in godbolt. if i remember the meeting notes correctly that should cover the master and 2.6 .

  • That should be sufficient. Can you push the simplified version?

  • added 1 commit

    • 3828e52f - add dynamic and static methods for factorials and binomials

    Compare with previous version

  • added 1 commit

    • a2403ebb - properly handle unsigned underflows

    Compare with previous version

  • added 1 commit

    • 30470fc9 - properly handle unsigned underflows

    Compare with previous version

  • mentioned in merge request dune-fem/dune-fem!227

  • added 252 commits

    Compare with previous version

  • Can this be merged or are there any concerns that need to be addressed?

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading