| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Jenkins Console Log Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal CPU: G++: Clang: |
Sorry, something went wrong.
|
the math and tests look good to me! @SteveBronder I'll let you comment on the cpp style |
Sorry, something went wrong.
There was a problem hiding this comment.
Few small things but overall good!
Sorry, something went wrong.
|
|
||
| typename plain_type_t<Vec>::Scalar sum_w(0); | ||
|
|
There was a problem hiding this comment.
| typename plain_type_t<Vec>::Scalar sum_w(0); | |
| value_type_t<Vec> sum_w(0); |
Sorry, something went wrong.
| if (unlikely(y.size() == 0)) { | ||
| return arena_t<ret_type>(Eigen::VectorXd{{0}}); | ||
| } | ||
| auto arena_y = to_arena(y); |
There was a problem hiding this comment.
| auto arena_y = to_arena(y); | |
| auto arena_y = to_arena(std::forward<T>(y)); |
Sorry, something went wrong.
| * @return Zero-sum vector of dimensionality K. | ||
| */ | ||
| template <typename T, require_rev_col_vector_t<T>* = nullptr> | ||
| inline auto sum_to_zero_constrain(const T& y) { |
There was a problem hiding this comment.
| inline auto sum_to_zero_constrain(const T& y) { | |
| inline auto sum_to_zero_constrain(T&& y) { |
Sorry, something went wrong.
| inline auto sum_to_zero_constrain(const T& y, scalar_type_t<T>& lp) { | ||
| return sum_to_zero_constrain(y); |
There was a problem hiding this comment.
| inline auto sum_to_zero_constrain(const T& y, scalar_type_t<T>& lp) { | |
| return sum_to_zero_constrain(y); | |
| inline auto sum_to_zero_constrain(T&& y, scalar_type_t<T>& lp) { | |
| return sum_to_zero_constrain(std::forward<T>(y)); |
Sorry, something went wrong.
Jenkins Console Log Machine information No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal CPU: G++: Clang: |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This is an alternative to #3099 based on the discussion in the comments there. Rather than x[1:N-1] = y; x[N] = -sum(y) this uses a modification of the isometric log ratio (ILR) transformation for simplexes. The implementation is based on a single for-loop, but was adapted from Sean's code that used several temporary vectors, which was adapted from a version which used a full matrix
Tests
Added tests in the err and constraint folders, based on the existing tests for simplex.
In addition, I iterated on the implementation of this algorithm in Python, so I have some out-of-tree tests here: https://gist.github.com/WardBrian/aae35c65fb841f923d89cc30a3d70808
Side Effects
Release notes
Added sum_to_zero_constrain, sum_to_zero_free, and check_sum_to_zero.
Checklist
Copyright holder: Simons Foundation
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested