Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
scaled_add.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__FUNCTIONS__SCALED_ADD_HPP__
2 #define __STAN__MATH__FUNCTIONS__SCALED_ADD_HPP__
3 
4 #include <vector>
5 
6 namespace stan {
7  namespace math {
8 
9  // x <- x + lambda * y
10  inline void scaled_add(std::vector<double>& x,
11  const std::vector<double>& y,
12  const double lambda) {
13  for (size_t i = 0; i < x.size(); ++i)
14  x[i] += lambda * y[i];
15  }
16 
17  }
18 }
19 
20 #endif

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