Stan Math Library: stan/math/prim/arr/fun/scaled_add.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <vector>
5 #include <cstddef>
6
7 namespace stan {
8 namespace math {
9
10 // x <- x + lambda * y
11 inline void scaled_add(std::vector<double>& x,
12 const std::vector<double>& y,
13 const double lambda) {
14 for (size_t i = 0; i < x.size(); ++i)
15 x[i] += lambda * y[i];
16 }
17
18 }
19 }
20
21 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::scaled_add
void scaled_add(std::vector< double > &x, const std::vector< double > &y, const double lambda)
Definition: scaled_add.hpp:11

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