Skip to content

Conversation

@akleeman
Copy link
Contributor

@akleeman akleeman commented Feb 1, 2019

Only compute the right hand side of a covariance product if the left hand side isn't 0.

This way if you have some covariance function which is complex:

SlowCovarianceFunction slow;

we can then introduce decorrelating product functions,

class OnlyOdd : public CovarianceFunction<OnlyOdd> {
    double call_impl_(const int x, const int y) const {
        if (x % 2 && y %% 2) {
            return 1.;
        } else {
            return 0.;
        }
    }
}

Such that if you then form:

OnlyOdd odd;
auto product = odd * slow;

Evaluation of the slow function in product will only be done for odd numbers.

Copy link
Contributor

@seth-swiftnav seth-swiftnav left a comment

Choose a reason for hiding this comment

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

Looks Great. The description was much more confusing than the code itself.

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

Successfully merging this pull request may close these issues.

2 participants