Skip to content

Commit 6ecb9c0

Browse files
committed
Bump version to 2.39.0
1 parent d19186c commit 6ecb9c0

169 files changed

Lines changed: 4898 additions & 1678 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: StanEstimators
22
Title: Estimate Parameters for Arbitrary R Functions using 'Stan'
3-
Version: 0.3.1
3+
Version: 0.4.0
44
Authors@R: c(
55
person(given = c("Andrew", "R."), family = "Johnson", role = c("aut", "cre"),
66
email = "andrew.johnson@arjohnsonau.com",

src/include/cmdstan/command_helper.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ Eigen::VectorXd get_laplace_mode(const std::string &fname,
528528
* @param model Stan model
529529
* @return vector of vectors of parameter estimates
530530
*/
531-
std::vector<std::vector<double>> get_uparams_r(
531+
inline std::vector<std::vector<double>> get_uparams_r(
532532
const std::string &fname, const stan::model::model_base &model) {
533533
size_t u_params_cols = 0;
534534
size_t u_params_rows = 0;
@@ -559,8 +559,8 @@ std::vector<std::vector<double>> get_uparams_r(
559559
std::vector<std::vector<double>> params_r_ind(
560560
u_params_rows, std::vector<double>(u_params_cols));
561561
size_t idx = 0;
562-
for (size_t i = 0; i < u_params_rows; ++i) {
563-
for (size_t j = 0; j < u_params_cols; ++j) {
562+
for (size_t j = 0; j < u_params_cols; ++j) {
563+
for (size_t i = 0; i < u_params_rows; ++i) {
564564
params_r_ind[i][j] = *(u_params_r.data() + idx);
565565
++idx;
566566
}
@@ -577,9 +577,10 @@ std::vector<std::vector<double>> get_uparams_r(
577577
* @param params_set array of unconstrained parameter values
578578
* @
579579
*/
580-
void services_log_prob_grad(const stan::model::model_base &model, bool jacobian,
581-
std::vector<std::vector<double>> &params_set,
582-
stan::callbacks::writer &output) {
580+
inline void services_log_prob_grad(const stan::model::model_base &model,
581+
bool jacobian,
582+
std::vector<std::vector<double>> &params_set,
583+
stan::callbacks::writer &output) {
583584
// header
584585
std::vector<std::string> p_names{"lp__"};
585586
model.unconstrained_param_names(p_names, false, false);

src/include/cmdstan/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#endif
1313

1414
#define CMDSTAN_MAJOR 2
15-
#define CMDSTAN_MINOR 38
15+
#define CMDSTAN_MINOR 39
1616
#define CMDSTAN_PATCH 0
1717

1818
namespace cmdstan {

src/include/estimator/estimator.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by stanc v2.38.0
1+
// Code generated by stanc v2.39.0
22
#include <stan/model/model_header.hpp>
33
namespace estimator_model_namespace {
44
using stan::model::model_base_crtp;
@@ -129,7 +129,7 @@ class estimator_model final : public model_base_crtp<estimator_model> {
129129
return "estimator_model";
130130
}
131131
inline std::vector<std::string> model_compile_info() const noexcept {
132-
return std::vector<std::string>{"stanc_version = stanc3 v2.38.0",
132+
return std::vector<std::string>{"stanc_version = stanc3 v2.39.0",
133133
"stancflags = --O1 --allow-undefined"};
134134
}
135135
// Base log prob
@@ -462,4 +462,4 @@ new_model(stan::io::var_context& data_context, unsigned int seed,
462462
stan::math::profile_map& get_stan_profile_data() {
463463
return estimator_model_namespace::profiles__;
464464
}
465-
#endif
465+
#endif

src/include/stan/io/stan_csv_reader.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ class stan_csv_reader {
300300
double warmup;
301301
std::stringstream(line.substr(left, right - left)) >> warmup;
302302
timing.warmup += warmup;
303-
} else if (line.find("(Sampling)") != std::string::npos) {
303+
} else if (line.find("(Sampling)") != std::string::npos
304+
|| line.find("(Generated Quantities)")
305+
!= std::string::npos) {
304306
int left = 17;
305307
int right = line.find(" seconds");
306308
double sampling;

src/include/stan/math/fwd/fun.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#include <stan/math/fwd/fun/tcrossprod.hpp>
117117
#include <stan/math/fwd/fun/tgamma.hpp>
118118
#include <stan/math/fwd/fun/to_fvar.hpp>
119+
#include <stan/math/fwd/fun/trace_dot.hpp>
119120
#include <stan/math/fwd/fun/trace_quad_form.hpp>
120121
#include <stan/math/fwd/fun/trigamma.hpp>
121122
#include <stan/math/fwd/fun/trunc.hpp>

src/include/stan/math/fwd/fun/atan.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ inline fvar<T> atan(const fvar<T>& x) {
2222
*
2323
* @tparam T autodiff value type
2424
* @param[in] z argument
25-
* @return arc tanget of the argument
25+
* @return arc tangent of the argument
2626
*/
2727
template <typename T>
2828
inline std::complex<fvar<T>> atan(const std::complex<fvar<T>>& z) {

src/include/stan/math/fwd/fun/read_fvar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class read_fvar_functor {
3232

3333
/**
3434
* Function applying the read_fvar_functor to extract the values
35-
* and tangets of a given fvar matrix into separate matrices.
35+
* and tangents of a given fvar matrix into separate matrices.
3636
*
3737
* @tparam EigFvar type of the Eigen container of fvar.
3838
* @tparam EigOut type of the Eigen containers to copy to
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#ifndef STAN_MATH_FWD_FUN_TRACE_DOT_HPP
2+
#define STAN_MATH_FWD_FUN_TRACE_DOT_HPP
3+
4+
#include <stan/math/fwd/core.hpp>
5+
#include <stan/math/fwd/fun/multiply.hpp>
6+
#include <stan/math/prim/err.hpp>
7+
#include <stan/math/prim/fun/trace.hpp>
8+
9+
namespace stan {
10+
namespace math {
11+
12+
/**
13+
* Compute the trace of the product of two matrices with
14+
* forward-mode autodiff support.
15+
*
16+
* @tparam EigMat1 A type either inheriting from `Eigen::DenseBase` or a
17+
* `var_value` with an inner type inheriting from `Eigen::DenseBase`
18+
* @tparam EigMat2 A type either inheriting from `Eigen::DenseBase` or a
19+
* `var_value` with an inner type inheriting from `Eigen::DenseBase`
20+
*
21+
* @param A first matrix (m x n)
22+
* @param B second matrix (n x m)
23+
* @return trace of A * B
24+
* @throw std::invalid_argument if A and B have incompatible dimensions
25+
*/
26+
template <typename EigMat1, typename EigMat2,
27+
require_all_eigen_t<EigMat1, EigMat2>* = nullptr,
28+
require_any_vt_fvar<EigMat1, EigMat2>* = nullptr>
29+
inline return_type_t<EigMat1, EigMat2> trace_dot(EigMat1&& A, EigMat2&& B) {
30+
check_size_match("trace_dot", "A.cols()", A.cols(), "B.rows()", B.rows());
31+
check_size_match("trace_dot", "A.rows()", A.rows(), "B.cols()", B.cols());
32+
return trace(multiply(std::forward<EigMat1>(A), std::forward<EigMat2>(B)));
33+
}
34+
35+
} // namespace math
36+
} // namespace stan
37+
#endif

src/include/stan/math/fwd/functor/finite_diff.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ inline auto aggregate_tangent(const FuncTangent& tangent, const InputArg& arg) {
5151

5252
/**
5353
* Construct an fvar<T> where the tangent is calculated by finite-differencing.
54-
* Finite-differencing is only perfomed where the scalar type to be evaluated is
55-
* `fvar<T>.
54+
* Finite-differencing is only performed where the scalar type to be evaluated
55+
* is `fvar<T>.
5656
*
5757
* Higher-order inputs (i.e., fvar<var> & fvar<fvar<T>>) are also implicitly
5858
* supported through auto-diffing the finite-differencing process.
@@ -95,8 +95,8 @@ inline auto finite_diff(const F& func, const TArgs&... args) {
9595

9696
/**
9797
* Construct an fvar<T> where the tangent is calculated by finite-differencing.
98-
* Finite-differencing is only perfomed where the scalar type to be evaluated is
99-
* `fvar<T>.
98+
* Finite-differencing is only performed where the scalar type to be evaluated
99+
* is `fvar<T>.
100100
*
101101
* This overload is used when no fvar<T> arguments are passed and simply
102102
* evaluates the functor with the provided arguments.

0 commit comments

Comments
 (0)