All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
inverse_softmax.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_INVERSE_SOFTMAX_HPP
#define STAN_MATH_PRIM_SCAL_FUN_INVERSE_SOFTMAX_HPP
#include <boost/math/tools/promotion.hpp>
#include <boost/throw_exception.hpp>
#include <stdexcept>
namespace stan {
namespace math {
template <typename Vector>
void inverse_softmax(const Vector& simplex, Vector& y) {
using std::log;
if (simplex.size() != y.size())
BOOST_THROW_EXCEPTION(std::invalid_argument
("simplex.size() != y.size()"));
for (size_t i = 0; i < simplex.size(); ++i)
y[i] = log(simplex[i]);
}
}
}
#endif
stan::math::inverse_softmax
void inverse_softmax(const Vector &simplex, Vector &y)
Writes the inverse softmax of the simplex argument into the second argument.
Definition: inverse_softmax.hpp:34
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
stan::math::invalid_argument
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw an invalid_argument exception with a consistently formatted message.
Definition: invalid_argument.hpp:31

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