Public Member Functions | List of all members
stan::math::internal::map_rect_reduce< F, var, double > Struct Template Reference

#include "stan/math/rev/mat/functor/map_rect_reduce.hpp"

Public Member Functions

matrix_d operator() (const vector_d &shared_params, const vector_d &job_specific_params, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs=nullptr) const
 

Detailed Description

template<typename F>
struct stan::math::internal::map_rect_reduce< F, var, double >

Definition at line 95 of file map_rect_reduce.hpp.

Member Function Documentation

template<typename F >
matrix_d stan::math::internal::map_rect_reduce< F, var, double >::operator() ( const vector_d shared_params,
const vector_d job_specific_params,
const std::vector< double > &  x_r,
const std::vector< int > &  x_i,
std::ostream *  msgs = nullptr 
) const
inline

Definition at line 96 of file map_rect_reduce.hpp.

References stan::math::e(), F, MECModelEnuComparisons::i, calib::j, lem_server::msgs, confusionMatrixTree::out, stan::math::recover_memory_nested(), stan::math::set_zero_all_adjoints_nested(), stan::math::start_nested(), and stan::math::to_var().

100  {
101  const size_type num_shared_params = shared_params.rows();
102  matrix_d out(1 + num_shared_params, 0);
103 
104  try {
105  start_nested();
106  vector_v shared_params_v = to_var(shared_params);
107 
108  vector_v fx_v = F()(shared_params_v, job_specific_params, x_r, x_i, msgs);
109 
110  const size_type size_f = fx_v.rows();
111 
112  out.resize(Eigen::NoChange, size_f);
113 
114  for (size_type i = 0; i < size_f; ++i) {
115  out(0, i) = fx_v(i).val();
117  fx_v(i).grad();
118  for (size_type j = 0; j < num_shared_params; ++j)
119  out(1 + j, i) = shared_params_v(j).vi_->adj_;
120  }
122  } catch (const std::exception& e) {
124  throw;
125  }
126  return out;
127  }
#define F(x, y, z)
Eigen::Matrix< var, Eigen::Dynamic, 1 > vector_v
Definition: typedefs.hpp:22
static void set_zero_all_adjoints_nested()
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Definition: typedefs.hpp:11
const double j
Definition: BetheBloch.cxx:29
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > matrix_d
Definition: typedefs.hpp:19
double e()
Definition: constants.hpp:89
static void recover_memory_nested()
std::vector< var > to_var(const std::vector< double > &v)
Definition: to_var.hpp:19
static void start_nested()

The documentation for this struct was generated from the following file: