-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bit of cleanup and added adapter file (Issue #2197)
- Loading branch information
Showing
3 changed files
with
78 additions
and
46 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef STAN_MATH_PRIM_FUNCTOR_INTEGRATE_1D_ADAPTER_HPP | ||
#define STAN_MATH_PRIM_FUNCTOR_INTEGRATE_1D_ADAPTER_HPP | ||
|
||
#include <ostream> | ||
#include <vector> | ||
|
||
/** | ||
* Adapt the non-variadic integrate_1d arguments to the variadic | ||
* integrate_1d_impl interface | ||
* | ||
* @tparam F type of function to adapt | ||
*/ | ||
template <typename F> | ||
struct integrate_1d_adapter { | ||
const F& f_; | ||
|
||
explicit integrate_1d_adapter(const F& f) : f_(f) {} | ||
|
||
template <typename T_a, typename T_b, typename T_theta> | ||
auto operator()(const T_a& x, const T_b& xc, | ||
std::ostream *msgs, | ||
const std::vector<T_theta> &theta, | ||
const std::vector<double> &x_r, | ||
const std::vector<int> &x_i) const { | ||
return f_(x, xc, theta, x_r, x_i, msgs); | ||
} | ||
}; | ||
|
||
#endif |
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