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

Compute cross-correlation matrices without matrix inversion #6339

Merged

Conversation

Blunde1
Copy link
Contributor

@Blunde1 Blunde1 commented Oct 16, 2023

Issue
Resolves #6330

Approach
Use @tommyod approach #4243 (comment)

@Blunde1 Blunde1 self-assigned this Oct 16, 2023
@kvashchuka
Copy link
Contributor

@Blunde1 I have checked and the tests with adaptive localization threshold 0.0 and 1.0 pass👍

Copy link
Contributor

@tommyod tommyod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment on a small function. Take it or leave it :)

Section 2.3 - Localization in the CHOP problem
"""
default_threshold = 3 / math.sqrt(ensemble_size)
if user_defined_threshold == -1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't compare floats using ==.


In fact, I think using None is better here. More typical Python, more readable:

if user_defined_threshold is None:
    return default_threshold

Come to think of it, I believe the (1) decision to use the default or user defined threshold and (2) retrieving the default threshold are two separate concerns. I think this is better:

threshold = # either a float in [0, 1], or None
self.threshold = correlation_threshold(ensemble_size) if threshold is None else threshold

In other words, remove user_defined_threshold entirely. The decision is already taken before the function is called (by setting it to -1 / None), so no need to propagate the data down into the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this.
Could you make an issue with this?

@Blunde1 Blunde1 force-pushed the efficient-cross-correlation branch 6 times, most recently from 7055dcc to 19072b4 Compare October 18, 2023 09:15
Copy link
Contributor

@dafeda dafeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@kvashchuka kvashchuka merged commit 2662448 into equinor:localization Oct 18, 2023
39 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants