Automatic Differentiation
 
Loading...
Searching...
No Matches
inverse_softmax.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_ARR_SCAL_FUN_INVERSE_SOFTMAX_HPP
2#define STAN_MATH_ARR_SCAL_FUN_INVERSE_SOFTMAX_HPP
3
7#include <cmath>
8
9namespace stan {
10namespace math {
11
36template <typename Vector, require_vector_t<Vector>* = nullptr>
37void inverse_softmax(const Vector& simplex, Vector& y) {
38 check_matching_sizes("inverse_softmax", "simplex", simplex, "y", y);
39 y = log(simplex);
40}
41
42} // namespace math
43} // namespace stan
44#endif
fvar< T > log(const fvar< T > &x)
Definition log.hpp:15
void check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Check if two structures at the same size.
void inverse_softmax(const Vector &simplex, Vector &y)
Writes the inverse softmax of the simplex argument into the second argument.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9