Skip to content

Instantly share code, notes, and snippets.

@SteveBronder
Created May 13, 2020 19:51
Show Gist options
  • Save SteveBronder/6f03dbf282a031e81beea46e8312e5be to your computer and use it in GitHub Desktop.
Save SteveBronder/6f03dbf282a031e81beea46e8312e5be to your computer and use it in GitHub Desktop.
#ifndef STAN_MATH_REV_FUN_LAMBERT_W_HPP
#define STAN_MATH_REV_FUN_LAMBERT_W_HPP
#include <stan/math/rev/core.hpp>
#include <stan/math/rev/meta.hpp>
#include <stan/math/prim/meta.hpp>
#include <stan/math/prim/fun/lambert_w.hpp>
namespace stan {
namespace math {
namespace internal {
class lambertw0_vari : public op_v_vari {
public:
explicit lambertw0_vari(vari* avi) : op_v_vari(lambert_w0(avi->val_), avi) {}
void chain() {
avi_->adj_ += adj_ + boost::math::lambert_w0_prime(avi_->val_) ;
}
};
} // namespace internal
inline var lambert_w0(const var& a) { return var(new internal::lambertw0_vari(a.vi_)); }
} // namespace math
} // namespace stan
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment