-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
adds unary var matrix functions #2362
Conversation
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I have one minor question.
My first time reviewing varmat stuff so hopefully I didnt miss anything.
template <typename T, require_var_matrix_t<T>* = nullptr> | ||
inline auto Phi_approx(const T& a) { | ||
arena_t<value_type_t<T>> f(a.rows(), a.cols()); | ||
arena_t<value_type_t<T>> da(a.rows(), a.cols()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to compute this in the forward pass? I guess we would compute av_squared twice if we compute this in the backward pass. Is that the reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's the general jist. we can compute adjoint while calculating the forward pass so it's just nice to alloc everything at once, throw it in one big loop, and then have an easy peasy reverse pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The varmat rev functions are missing doxygen. Other than that I think this looks good.
}); | ||
} | ||
|
||
template <typename T, require_var_matrix_t<T>* = nullptr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need doxygen here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added doxygen and simplified a couple tests. This looks good to me. @SteveBronder check my commits and merge if the tests pass.
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good!
Summary
Adds
var<Matrix>
specializations for digamma, distance, Phi, Phi_approx, inv_Phi, sqrt, tail, and tgamma.Tests
var matrix tests added for each function and can be run with
Side Effects
Nope!
Release notes
var<Matrix>
overloads for digamma, distance, Phi, inv_Phi, Phi_approx, sqrt, tail, and tgammaChecklist
Math issue How to add static matrix? #1805
Copyright holder: Steve Bronder
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