Skip to content

Commit c89ca16

Browse files
authored
Merge pull request #3245 from stan-dev/fix/inline
Add `inline` to all functions
2 parents 407dcfe + 021bac4 commit c89ca16

647 files changed

Lines changed: 1934 additions & 1817 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

stan/math/fwd/fun/hypergeometric_1F0.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace math {
3131
template <typename Ta, typename Tz, typename FvarT = return_type_t<Ta, Tz>,
3232
require_all_stan_scalar_t<Ta, Tz>* = nullptr,
3333
require_any_fvar_t<Ta, Tz>* = nullptr>
34-
FvarT hypergeometric_1F0(const Ta& a, const Tz& z) {
34+
inline FvarT hypergeometric_1F0(const Ta& a, const Tz& z) {
3535
partials_type_t<Ta> a_val = value_of(a);
3636
partials_type_t<Tz> z_val = value_of(z);
3737
FvarT rtn = FvarT(hypergeometric_1F0(a_val, z_val), 0.0);

stan/math/fwd/fun/polar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ inline std::complex<fvar<T>> polar(const fvar<T>& r, U theta) {
4444
* Returns complex number with specified magnitude and phase angle.
4545
*
4646
* @tparam T autodiff value type for phase angle
47-
+* * @tparam U arithmetic type for magnitude
47+
* * @tparam U arithmetic type for magnitude
4848
* @param[in] r magnitude
4949
* @param[in] theta phase angle
5050
* @return complex number with magnitude and phase angle

stan/math/fwd/functor/gradient.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace math {
3737
* @param[out] grad_fx Gradient of function at argument
3838
*/
3939
template <typename T, typename F>
40-
void gradient(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x, T& fx,
41-
Eigen::Matrix<T, Eigen::Dynamic, 1>& grad_fx) {
40+
inline void gradient(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
41+
T& fx, Eigen::Matrix<T, Eigen::Dynamic, 1>& grad_fx) {
4242
Eigen::Matrix<fvar<T>, Eigen::Dynamic, 1> x_fvar(x.size());
4343
grad_fx.resize(x.size());
4444
for (int i = 0; i < x.size(); ++i) {

stan/math/fwd/functor/hessian.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ namespace math {
3838
* @param[out] H Hessian of function at argument
3939
*/
4040
template <typename T, typename F>
41-
void hessian(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x, T& fx,
42-
Eigen::Matrix<T, Eigen::Dynamic, 1>& grad,
43-
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& H) {
41+
inline void hessian(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
42+
T& fx, Eigen::Matrix<T, Eigen::Dynamic, 1>& grad,
43+
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& H) {
4444
H.resize(x.size(), x.size());
4545
grad.resize(x.size());
4646
// size 0 separate because nothing to loop over in main body

stan/math/fwd/functor/jacobian.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace stan {
88
namespace math {
99

1010
template <typename T, typename F>
11-
void jacobian(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
12-
Eigen::Matrix<T, Eigen::Dynamic, 1>& fx,
13-
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& J) {
11+
inline void jacobian(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
12+
Eigen::Matrix<T, Eigen::Dynamic, 1>& fx,
13+
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& J) {
1414
using Eigen::Dynamic;
1515
using Eigen::Matrix;
1616
Matrix<fvar<T>, Dynamic, 1> x_fvar(x.size());

stan/math/memory/stack_alloc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace math {
2626
* @tparam Type of object to which pointer points.
2727
*/
2828
template <typename T>
29-
bool is_aligned(T* ptr, unsigned int bytes_aligned) {
29+
inline bool is_aligned(T* ptr, unsigned int bytes_aligned) {
3030
return (reinterpret_cast<uintptr_t>(ptr) % bytes_aligned) == 0U;
3131
}
3232

stan/math/mix/functor/hessian_times_vector.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ inline void hessian_times_vector(
3838
template <typename T, typename F, typename EigVec,
3939
require_eigen_vector_t<EigVec>* = nullptr,
4040
require_stan_scalar_t<T>* = nullptr>
41-
void hessian_times_vector(const F& f,
42-
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
43-
const EigVec& v, T& fx,
44-
Eigen::Matrix<T, Eigen::Dynamic, 1>& Hv) {
41+
inline void hessian_times_vector(const F& f,
42+
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
43+
const EigVec& v, T& fx,
44+
Eigen::Matrix<T, Eigen::Dynamic, 1>& Hv) {
4545
using Eigen::Matrix;
4646
Matrix<T, Eigen::Dynamic, 1> grad;
4747
Matrix<T, Eigen::Dynamic, Eigen::Dynamic> H;

stan/math/mix/functor/partial_derivative.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ namespace math {
2222
* @param[out] dfx_dxn Value of partial derivative
2323
*/
2424
template <typename T, typename F>
25-
void partial_derivative(const F& f,
26-
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x, int n,
27-
T& fx, T& dfx_dxn) {
25+
inline void partial_derivative(const F& f,
26+
const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
27+
int n, T& fx, T& dfx_dxn) {
2828
Eigen::Matrix<fvar<T>, Eigen::Dynamic, 1> x_fvar(x.size());
2929
for (int i = 0; i < x.size(); ++i) {
3030
x_fvar(i) = fvar<T>(x(i), i == n);

stan/math/opencl/copy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ inline T_dst from_matrix_cl(const matrix_cl<T>& src) {
232232
* @return Eigen matrix with a copy of the data in the source matrix
233233
*/
234234
template <typename T, require_all_kernel_expressions_t<T>* = nullptr>
235-
auto from_matrix_cl(const T& src) {
235+
inline auto from_matrix_cl(const T& src) {
236236
return from_matrix_cl<
237237
Eigen::Matrix<scalar_type_t<T>, Eigen::Dynamic, Eigen::Dynamic>>(src);
238238
}

stan/math/opencl/indexing_rev.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ namespace math {
1919
* @param idx indices
2020
* @param res adjoint of the result of the indexing operation
2121
*/
22-
void indexing_rev(matrix_cl<double>& adj, const matrix_cl<int>& idx,
23-
const matrix_cl<double>& res) {
22+
inline void indexing_rev(matrix_cl<double>& adj, const matrix_cl<int>& idx,
23+
const matrix_cl<double>& res) {
2424
int local_mem_size
2525
= opencl_context.device()[0].getInfo<CL_DEVICE_LOCAL_MEM_SIZE>();
2626
int preferred_work_groups

0 commit comments

Comments
 (0)