Removed unncessary sigma in function elbo of gplvm.py (and save N^2+1 operations) by joacorapela · Pull Request #1685 · GPflow/GPflow

PR type: enhancement

Related issue(s)/PRs:

Summary

In function elbo of gplvm.py the calculation of sigma is unnecessary.
Proposed changes

  • In function elbo of gplvm.py sigma is only used to first divide A and then to divide c. As A is only used to calculate c, we can avoid dividing A by sigma by dividing c by sigma2. In this way we save N^2 divisions (assuming N is the dimension of A) and one square root operation.
  • Equations explaining this pull request appear here
  • I tested that the resulting elbo is equal with the current version of the code and with the modification proposed here.

What alternatives have you considered?

Minimal working example

# Put your example code in here

Release notes

Fully backwards compatible: yes

If not, why is it worth breaking backwards compatibility:

PR checklist

  • New features: code is well-documented
    • detailed docstrings (API documentation)
    • notebook examples (usage demonstration)
  • The bug case / new feature is covered by unit tests
  • Code has type annotations
  • Build checks
    • I ran the black+isort formatter (make format)
    • I locally tested that the tests pass (make check-all)
  • Release management
    • RELEASE.md updated with entry for this change
    • New contributors: I've added myself to CONTRIBUTORS.md