-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
var matrix specializations for a-c unary functions in rev #2256
Merged
Merged
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0c52267
adds unary functions from a to c for varmat
SteveBronder 17b853d
Merge remote-tracking branch 'origin/develop' into feature/varmat-a-t…
SteveBronder 2f8da9f
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot fe2354c
update docs
SteveBronder afda49a
Merge commit '7f3792baa9e91438e79a2cf6594a38d105c9b24e' into HEAD
yashikno 91d1472
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot da21330
Merge remote-tracking branch 'origin/develop' into feature/varmat-a-t…
SteveBronder 86d6f8a
add tests for vectors of varmat
SteveBronder 13974c1
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 77f77e8
update abs so it can be vectorized
SteveBronder 1768e1e
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 198bec3
update abs so it can be vectorized
SteveBronder 010ebaf
Merge branch 'feature/varmat-a-to-c-unary' of github.com:stan-dev/mat…
SteveBronder fac9b65
update with develop, write out sin and tan
SteveBronder 11e3459
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 3a02c30
updates to use cwiseproduct()
SteveBronder 237f6a0
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 0e610cf
update tan test
SteveBronder 37d61ac
update tan requires
SteveBronder b0738f7
Merge commit '72552dcc6040018b35d2bb1303b461493b815d95' into HEAD
yashikno ba7dae7
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 8129f72
update tan requires
SteveBronder 88c35d9
update tan requires
SteveBronder 4fa4816
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 0db6223
Fixes tests and docs for var<matrix> trig functions and apply_scalar_…
SteveBronder a7deb36
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 7e41553
Updated abs/fabs tests to be like the others (Issue #2101)
bbbales2 b26159f
remove .noalias() from trig functions in rev
SteveBronder 812ae25
Merge commit '3d03131bdcbb2d33878f4117c857ac6404c7e10e' into HEAD
yashikno c5caa59
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,50 +10,50 @@ | |
namespace stan { | ||
namespace math { | ||
|
||
/** | ||
* Structure to wrap `abs()` so it can be vectorized. | ||
* | ||
* @tparam T type of variable | ||
* @param x argument | ||
* @return Arc cosine of variable in radians. | ||
*/ | ||
struct abs_fun { | ||
template <typename T> | ||
static inline T fun(const T& x) { | ||
using std::fabs; | ||
return fabs(x); | ||
} | ||
}; | ||
/** | ||
* Structure to wrap `abs()` so it can be vectorized. | ||
* | ||
* @tparam T type of variable | ||
* @param x argument | ||
* @return Arc cosine of variable in radians. | ||
*/ | ||
struct abs_fun { | ||
template <typename T> | ||
static inline T fun(const T& x) { | ||
using std::fabs; | ||
return fabs(x); | ||
} | ||
}; | ||
|
||
/** | ||
* Returns the elementwise `abs()` of the input, | ||
* which may be a scalar or any Stan container of numeric scalars. | ||
* | ||
* @tparam Container type of container | ||
* @param x argument | ||
* @return Arc cosine of each variable in the container, in radians. | ||
*/ | ||
template <typename Container, | ||
require_not_container_st<std::is_arithmetic, Container>* = nullptr, | ||
require_not_var_matrix_t<Container>* = nullptr> | ||
inline auto abs(const Container& x) { | ||
return apply_scalar_unary<abs_fun, Container>::apply(x); | ||
} | ||
/** | ||
* Returns the elementwise `abs()` of the input, | ||
* which may be a scalar or any Stan container of numeric scalars. | ||
* | ||
* @tparam Container type of container | ||
* @param x argument | ||
* @return Arc cosine of each variable in the container, in radians. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolute value |
||
*/ | ||
template <typename Container, | ||
require_not_container_st<std::is_arithmetic, Container>* = nullptr, | ||
require_not_var_matrix_t<Container>* = nullptr> | ||
inline auto abs(const Container& x) { | ||
return apply_scalar_unary<abs_fun, Container>::apply(x); | ||
} | ||
|
||
/** | ||
* Version of `abs()` that accepts std::vectors, Eigen Matrix/Array objects | ||
* or expressions, and containers of these. | ||
* | ||
* @tparam Container Type of x | ||
* @param x argument | ||
* @return Arc cosine of each variable in the container, in radians. | ||
*/ | ||
template <typename Container, | ||
require_container_st<std::is_arithmetic, Container>* = nullptr> | ||
inline auto abs(const Container& x) { | ||
return apply_vector_unary<Container>::apply( | ||
x, [](const auto& v) { return v.array().abs(); }); | ||
} | ||
/** | ||
* Version of `abs()` that accepts std::vectors, Eigen Matrix/Array objects | ||
* or expressions, and containers of these. | ||
* | ||
* @tparam Container Type of x | ||
* @param x argument | ||
* @return Arc cosine of each variable in the container, in radians. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolute value |
||
*/ | ||
template <typename Container, | ||
require_container_st<std::is_arithmetic, Container>* = nullptr> | ||
inline auto abs(const Container& x) { | ||
return apply_vector_unary<Container>::apply( | ||
x, [](const auto& v) { return v.array().abs(); }); | ||
} | ||
|
||
namespace internal { | ||
/** | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Absolute value