| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
exp.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_EXP_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_EXP_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <boost/math/special_functions/fpclassify.hpp>
6 #include <limits>
7
8 namespace stan {
9 namespace math {
10
17 template<typename T, int Rows, int Cols>
18 inline Eigen::Matrix<T, Rows, Cols>
19 exp(const Eigen::Matrix<T, Rows, Cols>& m) {
20 return m.array().exp().matrix();
21 }
22
23 // FIXME:
24 // specialization not needed once Eigen fixes issue:
25 // http:// eigen.tuxfamily.org/bz/show_bug.cgi?id=859
26 template<int Rows, int Cols>
27 inline Eigen::Matrix<double, Rows, Cols>
28 exp(const Eigen::Matrix<double, Rows, Cols>& m) {
29 Eigen::Matrix<double, Rows, Cols> mat = m.array().exp().matrix();
30 for (int i = 0, size_ = mat.size(); i < size_; i++)
31 if (boost::math::isnan(m(i)))
32 mat(i) = std::numeric_limits<double>::quiet_NaN();
33 return mat;
34 }
35
36 }
37 }
38 #endif
boost::math::isnan
bool isnan(const stan::math::var &v)
Checks if the given number is NaN.
Definition: boost_isnan.hpp:22
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
size_
size_t size_
Definition: dot_self.hpp:18
Eigen.hpp

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