Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • N NIFTy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 19
    • Issues 19
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ift
  • NIFTy
  • Merge requests
  • !630

Draft: Fix floating point error domain inequality bug

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Lukas Platz requested to merge fix_domain_equality_bug into NIFTy_7 Jun 01, 2021
  • Overview 8
  • Commits 1
  • Pipelines 1
  • Changes 2

As it turns out, in Python 1. / i * i is not exactly one for many integers, for example 49. In the range of 1-10000, this is true for 1178 ints. When creating an RGSpace d with the shape (i,), d == d.get_default_codomain().get_default_codomain() is not necessarily true, because of potentially unequal distances values.

This is problematic since harmonic transform operators constructed with domain=d.get_default_domain() without giving an explicit target will for many values of i have a target unequal from d.

To alleviate this, this patch modiefies the domain.__eq__() function to compare __hash__() return values instead of manually comparing domain values and modiefies the domain.__hash__() function to round the distances entries to 15 decimals prior to hashing.

If using the hash in the comparison is unfavorable because of its performance impact, __eq__() could be restored to is previous state and the distance rounding be implemented in it, too.

@mtr: what do you think about this patch? Is there an obviously better solution?

Edited Jun 01, 2021 by Lukas Platz
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix_domain_equality_bug