Add sum_to_zero_constrain and _free for matrix types#3169
Conversation
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
| double a_i = inv_sqrt((i + 1.0) * (i + 2.0)); | ||
| double b_i = (i + 1.0) * a_i; | ||
|
|
||
| auto b_i_x = b_i * x_ref.coeff(i, j) - ax_previous; |
There was a problem hiding this comment.
can this be declared without `auto'?
There was a problem hiding this comment.
It could be value_type_t<Mat>, if we wanted. I'm an auto fan, though
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Summary
Closes #3132. This adds new overloads for
sum_to_zero_constrainandsum_to_zero_freethat accept Eigen Matrix types.The return value of sum_to_zero_constrain sums to zero along each row and column (as well as the entire matrix summing to 0).
Tests
I added existing tests based on the ones already in the code for the vector overload
Side Effects
None
Release notes
Added new overloads for
sum_to_zero_constrainandsum_to_zero_freethat accept Eigen Matrix types.Checklist
Copyright holder: Simons Foundation (@WardBrian), Omnicom Media Group (@spinkney)
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
./runTests.py test/unit)make test-headers)make test-math-dependencies)make doxygen)make cpplint)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested