grad_tr_mat_times_hessian_test.cpp
Go to the documentation of this file.
2 #include <test/test-models/good/model/valid.hpp>
3 #include <gtest/gtest.h>
4 
6  int dim = 5;
7 
8  Eigen::VectorXd x(dim);
9  Eigen::MatrixXd X = Eigen::MatrixXd::Identity(dim, dim);
10  Eigen::VectorXd grad_tr_X_hess_f(dim);
11 
12  std::fstream data_stream(std::string("").c_str(), std::fstream::in);
13  stan::io::dump data_var_context(data_stream);
14  data_stream.close();
15 
16  std::stringstream output;
17 
18  valid_model_namespace::valid_model valid_model(data_var_context, &output);
19  EXPECT_NO_THROW(stan::model::grad_tr_mat_times_hessian(valid_model, x, X, grad_tr_X_hess_f));
20 
21  EXPECT_FLOAT_EQ(dim, x.size());
22  EXPECT_FLOAT_EQ(dim, X.rows());
23  EXPECT_FLOAT_EQ(dim, X.cols());
24  EXPECT_FLOAT_EQ(dim, grad_tr_X_hess_f.size());
25 
26  EXPECT_EQ("", output.str());
27 
28  // Incorporate once operands and partials has been generalized
29  //output.str("");
30  //domain_fail_namespace::domain_fail domain_fail_model(data_var_context, &output);
31  //EXPECT_THROW(stan::model::grad_tr_mat_times_hessian(domain_fail_model, x, X, grad_tr_X_hess_f),
32  // std::domain_error);
33  //EXPECT_EQ("", output.str());
34 }
ofstream output
void grad_tr_mat_times_hessian(const M &model, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &x, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &X, Eigen::Matrix< double, Eigen::Dynamic, 1 > &grad_tr_X_hess_f, std::ostream *msgs=0)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
ifstream in
Definition: comparison.C:7
TEST(ModelUtil, grad_tr_mat_times_hessian)
Float_t X
Definition: plot.C:38