Public Member Functions | List of all members
stan::math::internal::map_rect_reduce< F, double, var > 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, double, var >

Definition at line 59 of file map_rect_reduce.hpp.

Member Function Documentation

template<typename F >
matrix_d stan::math::internal::map_rect_reduce< F, double, var >::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 60 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().

64  {
65  const size_type num_job_specific_params = job_specific_params.rows();
66  matrix_d out(1 + num_job_specific_params, 0);
67 
68  try {
69  start_nested();
70  vector_v job_specific_params_v = to_var(job_specific_params);
71 
72  vector_v fx_v = F()(shared_params, job_specific_params_v, x_r, x_i, msgs);
73 
74  const size_type size_f = fx_v.rows();
75 
76  out.resize(Eigen::NoChange, size_f);
77 
78  for (size_type i = 0; i < size_f; ++i) {
79  out(0, i) = fx_v(i).val();
81  fx_v(i).grad();
82  for (size_type j = 0; j < num_job_specific_params; ++j)
83  out(1 + j, i) = job_specific_params_v(j).vi_->adj_;
84  }
86  } catch (const std::exception& e) {
88  throw;
89  }
90  return out;
91  }
#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: