Stan Math Library  2.20.0
reverse mode automatic differentiation
scaled_add.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_FUN_SCALED_ADD_HPP
2 #define STAN_MATH_PRIM_ARR_FUN_SCALED_ADD_HPP
3 
5 #include <vector>
6 #include <cstddef>
7 
8 namespace stan {
9 namespace math {
10 
11 inline void scaled_add(std::vector<double>& x, const std::vector<double>& y,
12  double lambda) {
13  for (size_t i = 0; i < x.size(); ++i)
14  x[i] += lambda * y[i];
15 }
16 
17 } // namespace math
18 } // namespace stan
19 
20 #endif
void scaled_add(std::vector< double > &x, const std::vector< double > &y, double lambda)
Definition: scaled_add.hpp:11

     [ Stan Home Page ] © 2011–2018, Stan Development Team.