-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistently treat profile blocks as blocks in optimizer #1281
Conversation
| Profile (_, stmts) -> | ||
Fmt.pf ppf "{@;<1 2>@[<v>%a@]@;}" Fmt.(list pp_s ~sep:cut) stmts | ||
| Profile (name, stmts) -> | ||
Fmt.pf ppf "profile(%s){@;<1 2>@[<v>%a@]@;}" name | ||
Fmt.(list pp_s ~sep:cut) | ||
stmts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good but doesn't seem to affect test output. Do we have any --debug-mir-pretty
tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we do not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have a pretty lacking use of the profile
block at all in our testing, which is part of why this was unnoticed
Huh, this seems to have uncovered another issue with profile blocks and the SoA pass. Trying to debug now. |
We sure this is fixed? Using the binary here, and this model: functions{
row_vector mike_dot(
int r
, int c
, vector beta
, row_vector zeros
, array[,] int index_pos_X_mat
, array[] int index_pos_X_sizes
, array[,] int col_index_into_X_first_unique_pos_X_mat
, array[] int col_index_into_X_first_unique_pos_X_sizes
, array[,] int index_of_cZ_for_each_col_in_Z_with_pos_X_mat
, array[] int index_of_cZ_for_each_col_in_Z_with_pos_X_sizes
, array[,] int index_neg_X_mat
, array[] int index_neg_X_sizes
, array[,] int col_index_into_X_first_unique_neg_X_mat
, array[] int col_index_into_X_first_unique_neg_X_sizes
, array[,] int index_of_cZ_for_each_col_in_Z_with_neg_X_mat
, array[] int index_of_cZ_for_each_col_in_Z_with_neg_X_sizes
) {
row_vector[c] out = zeros ;
for(i_r in 1:r){
out[
index_pos_X_mat[
i_r
, 1:(index_pos_X_sizes[i_r])
]
] = (
out[
col_index_into_X_first_unique_pos_X_mat[
i_r
, 1:(col_index_into_X_first_unique_pos_X_sizes[i_r])
]
]
+ beta[i_r]
)[
index_of_cZ_for_each_col_in_Z_with_pos_X_mat[
i_r
, 1:(index_of_cZ_for_each_col_in_Z_with_pos_X_sizes[i_r])
]
] ;
out[
index_neg_X_mat[
i_r
, 1:(index_neg_X_sizes[i_r])
]
] = (
out[
col_index_into_X_first_unique_neg_X_mat[
i_r
, 1:(col_index_into_X_first_unique_neg_X_sizes[i_r])
]
]
- beta[i_r]
)[
index_of_cZ_for_each_col_in_Z_with_neg_X_mat[
i_r
, 1:(index_of_cZ_for_each_col_in_Z_with_neg_X_sizes[i_r])
]
] ;
}
return(out);
}
}
data{
int r ;
int c ;
matrix[r,c] X;
row_vector[c] Y;
int index_pos_X_mat_rows ;
int index_pos_X_mat_cols ;
array[index_pos_X_mat_rows,index_pos_X_mat_cols] int index_pos_X_mat ;
array[index_pos_X_mat_rows] int index_pos_X_sizes ;
int col_index_into_X_first_unique_pos_X_mat_rows ;
int col_index_into_X_first_unique_pos_X_mat_cols ;
array[
col_index_into_X_first_unique_pos_X_mat_rows
,col_index_into_X_first_unique_pos_X_mat_cols
] int col_index_into_X_first_unique_pos_X_mat ;
array[
col_index_into_X_first_unique_pos_X_mat_rows
] int col_index_into_X_first_unique_pos_X_sizes ;
int index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows ;
int index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols ;
array[
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows
, index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols
] int index_of_cZ_for_each_col_in_Z_with_pos_X_mat ;
array[
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows
] int index_of_cZ_for_each_col_in_Z_with_pos_X_sizes ;
int index_neg_X_mat_rows ;
int index_neg_X_mat_cols ;
array[index_neg_X_mat_rows,index_neg_X_mat_cols] int index_neg_X_mat ;
array[index_neg_X_mat_rows] int index_neg_X_sizes ;
int col_index_into_X_first_unique_neg_X_mat_rows ;
int col_index_into_X_first_unique_neg_X_mat_cols ;
array[
col_index_into_X_first_unique_neg_X_mat_rows
,col_index_into_X_first_unique_neg_X_mat_cols
] int col_index_into_X_first_unique_neg_X_mat ;
array[
col_index_into_X_first_unique_neg_X_mat_rows
] int col_index_into_X_first_unique_neg_X_sizes ;
int index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows ;
int index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols ;
array[
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows
, index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols
] int index_of_cZ_for_each_col_in_Z_with_neg_X_mat ;
array[
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows
] int index_of_cZ_for_each_col_in_Z_with_neg_X_sizes ;
}
transformed data{
row_vector[c] zeros = zeros_row_vector(c) ;
}
parameters{
vector[r] beta ;
}
transformed parameters{
}
model{
row_vector[c] Z_mike ;
profile("mike"){
Z_mike = mike_dot(
r
, c
, beta
, zeros
, index_pos_X_mat
, index_pos_X_sizes
, col_index_into_X_first_unique_pos_X_mat
, col_index_into_X_first_unique_pos_X_sizes
, index_of_cZ_for_each_col_in_Z_with_pos_X_mat
, index_of_cZ_for_each_col_in_Z_with_pos_X_sizes
, index_neg_X_mat
, index_neg_X_sizes
, col_index_into_X_first_unique_neg_X_mat
, col_index_into_X_first_unique_neg_X_sizes
, index_of_cZ_for_each_col_in_Z_with_neg_X_mat
, index_of_cZ_for_each_col_in_Z_with_neg_X_sizes
) ;
}
beta ~ std_normal() ;
Y ~ normal(Z_mike,1.0) ;
}
generated quantities{
row_vector[c] Z_cdp ;
profile("cdp"){
Z_cdp = columns_dot_product(X,rep_matrix(beta,c)) ;
}
} I'm still getting the error:
|
Locally it is fixed for me. Can you check Also if you are using the script you used on the forums, the rebuild of cmdstan will override any custom stanc binary |
I skipped over the recompiling of cmdstan, so the new stanc was untouched. Here's the version: |
Can you try with the latest release? I know cmdstanr also does some cacheing so it might be worth making some small change to the model to force it to have a different hash? |
Seems to compile with that version, but with the warning:
|
Here's the contents of that file: // Code generated by stanc v2.31.0-68-gbd516d56
#include <stan/model/model_header.hpp>
namespace none_model_NA_NA_NA_none_NA_1_model_namespace {
using stan::model::model_base_crtp;
using namespace stan::math;
stan::math::profile_map profiles__;
static constexpr std::array<const char*, 68> locations_array__ =
{" (found before start of program)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 129, column 1 to column 17)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 138, column 12 to column 13)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 138, column 1 to column 23)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 20, column 13 to column 14)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 20, column 2 to column 29)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 22, column 3 to line 40, column 6)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 41, column 3 to line 59, column 6)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 21, column 17 to line 60, column 3)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 21, column 2 to line 60, column 3)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 61, column 2 to column 14)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 141, column 2 to line 158, column 5)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 140, column 1 to line 159, column 2)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 161, column 1 to column 22)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 162, column 1 to column 25)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 66, column 1 to column 8)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 67, column 1 to column 8)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 68, column 8 to column 9)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 68, column 10 to column 11)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 68, column 1 to column 15)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 69, column 12 to column 13)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 69, column 1 to column 17)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 71, column 1 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 72, column 1 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 73, column 7 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 73, column 28 to column 48)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 73, column 1 to column 71)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 74, column 7 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 74, column 1 to column 52)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 76, column 1 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 77, column 1 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 79, column 2 to column 46)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 80, column 3 to column 47)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 78, column 1 to line 81, column 48)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 83, column 2 to column 46)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 82, column 1 to line 84, column 50)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 86, column 1 to column 56)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 87, column 1 to column 56)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 89, column 2 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 90, column 4 to column 53)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 88, column 1 to line 91, column 53)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 93, column 2 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 92, column 1 to line 94, column 55)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 97, column 1 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 98, column 1 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 99, column 7 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 99, column 28 to column 48)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 99, column 1 to column 71)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 100, column 7 to column 27)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 100, column 1 to column 52)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 102, column 1 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 103, column 1 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 105, column 2 to column 46)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 106, column 3 to column 47)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 104, column 1 to line 107, column 48)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 109, column 2 to column 46)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 108, column 1 to line 110, column 50)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 112, column 1 to column 56)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 113, column 1 to column 56)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 115, column 2 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 116, column 4 to column 53)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 114, column 1 to line 117, column 53)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 119, column 2 to column 51)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 118, column 1 to line 120, column 55)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 125, column 12 to column 13)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 125, column 1 to column 44)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 129, column 8 to column 9)",
" (in '/tmp/RtmpJJA4oI/model-7c98365b5b7eb.stan', line 19, column 3 to line 62, column 2)"};
template <typename T2__, typename T3__,
stan::require_all_t<stan::is_col_vector<T2__>,
stan::is_vt_not_complex<T2__>,
stan::is_row_vector<T3__>,
stan::is_vt_not_complex<T3__>>* = nullptr>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T2__>,
stan::base_type_t<T3__>>,1,-1>
mike_dot(const int& r, const int& c, const T2__& beta_arg__, const T3__&
zeros_arg__, const std::vector<std::vector<int>>& index_pos_X_mat,
const std::vector<int>& index_pos_X_sizes,
const std::vector<std::vector<int>>&
col_index_into_X_first_unique_pos_X_mat, const std::vector<int>&
col_index_into_X_first_unique_pos_X_sizes,
const std::vector<std::vector<int>>&
index_of_cZ_for_each_col_in_Z_with_pos_X_mat,
const std::vector<int>&
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes,
const std::vector<std::vector<int>>& index_neg_X_mat,
const std::vector<int>& index_neg_X_sizes,
const std::vector<std::vector<int>>&
col_index_into_X_first_unique_neg_X_mat, const std::vector<int>&
col_index_into_X_first_unique_neg_X_sizes,
const std::vector<std::vector<int>>&
index_of_cZ_for_each_col_in_Z_with_neg_X_mat,
const std::vector<int>&
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes, std::ostream*
pstream__);
template <typename T2__, typename T3__,
stan::require_all_t<stan::is_col_vector<T2__>,
stan::is_vt_not_complex<T2__>,
stan::is_row_vector<T3__>,
stan::is_vt_not_complex<T3__>>*>
Eigen::Matrix<stan::promote_args_t<stan::base_type_t<T2__>,
stan::base_type_t<T3__>>,1,-1>
mike_dot(const int& r, const int& c, const T2__& beta_arg__, const T3__&
zeros_arg__, const std::vector<std::vector<int>>& index_pos_X_mat,
const std::vector<int>& index_pos_X_sizes,
const std::vector<std::vector<int>>&
col_index_into_X_first_unique_pos_X_mat, const std::vector<int>&
col_index_into_X_first_unique_pos_X_sizes,
const std::vector<std::vector<int>>&
index_of_cZ_for_each_col_in_Z_with_pos_X_mat,
const std::vector<int>&
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes,
const std::vector<std::vector<int>>& index_neg_X_mat,
const std::vector<int>& index_neg_X_sizes,
const std::vector<std::vector<int>>&
col_index_into_X_first_unique_neg_X_mat, const std::vector<int>&
col_index_into_X_first_unique_neg_X_sizes,
const std::vector<std::vector<int>>&
index_of_cZ_for_each_col_in_Z_with_neg_X_mat,
const std::vector<int>&
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes, std::ostream*
pstream__) {
using local_scalar_t__ = stan::promote_args_t<stan::base_type_t<T2__>,
stan::base_type_t<T3__>>;
int current_statement__ = 0;
const auto& beta = stan::math::to_ref(beta_arg__);
const auto& zeros = stan::math::to_ref(zeros_arg__);
static constexpr bool propto__ = true;
// suppress unused var warning
(void) propto__;
local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
// suppress unused var warning
(void) DUMMY_VAR__;
try {
current_statement__ = 4;
stan::math::validate_non_negative_index("out", "c", c);
Eigen::Matrix<local_scalar_t__,1,-1> out;
current_statement__ = 5;
stan::model::assign(out, zeros, "assigning variable out");
current_statement__ = 9;
for (int i_r = 1; i_r <= r; ++i_r) {
current_statement__ = 6;
stan::model::assign(out,
stan::model::rvalue(
stan::math::add(
stan::model::deep_copy(
stan::model::rvalue(out, "out",
stan::model::index_multi(
stan::model::rvalue(
col_index_into_X_first_unique_pos_X_mat,
"col_index_into_X_first_unique_pos_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(
col_index_into_X_first_unique_pos_X_sizes,
"col_index_into_X_first_unique_pos_X_sizes",
stan::model::index_uni(i_r))))))),
stan::model::rvalue(beta, "beta", stan::model::index_uni(i_r))),
"(FnDeepCopy__(out[col_index_into_X_first_unique_pos_X_mat[i_r,\n 1:col_index_into_X_first_unique_pos_X_sizes\n [i_r]]]) + \nbeta[i_r])",
stan::model::index_multi(
stan::model::rvalue(index_of_cZ_for_each_col_in_Z_with_pos_X_mat,
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes,
"index_of_cZ_for_each_col_in_Z_with_pos_X_sizes",
stan::model::index_uni(i_r)))))), "assigning variable out",
stan::model::index_multi(
stan::model::rvalue(index_pos_X_mat, "index_pos_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(index_pos_X_sizes, "index_pos_X_sizes",
stan::model::index_uni(i_r))))));
current_statement__ = 7;
stan::model::assign(out,
stan::model::rvalue(
stan::math::subtract(
stan::model::deep_copy(
stan::model::rvalue(out, "out",
stan::model::index_multi(
stan::model::rvalue(
col_index_into_X_first_unique_neg_X_mat,
"col_index_into_X_first_unique_neg_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(
col_index_into_X_first_unique_neg_X_sizes,
"col_index_into_X_first_unique_neg_X_sizes",
stan::model::index_uni(i_r))))))),
stan::model::rvalue(beta, "beta", stan::model::index_uni(i_r))),
"(FnDeepCopy__(out[col_index_into_X_first_unique_neg_X_mat[i_r,\n 1:col_index_into_X_first_unique_neg_X_sizes\n [i_r]]]) - \nbeta[i_r])",
stan::model::index_multi(
stan::model::rvalue(index_of_cZ_for_each_col_in_Z_with_neg_X_mat,
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes,
"index_of_cZ_for_each_col_in_Z_with_neg_X_sizes",
stan::model::index_uni(i_r)))))), "assigning variable out",
stan::model::index_multi(
stan::model::rvalue(index_neg_X_mat, "index_neg_X_mat",
stan::model::index_uni(i_r),
stan::model::index_min_max(1,
stan::model::rvalue(index_neg_X_sizes, "index_neg_X_sizes",
stan::model::index_uni(i_r))))));
}
current_statement__ = 10;
return out;
} catch (const std::exception& e) {
stan::lang::rethrow_located(e, locations_array__[current_statement__]);
}
}
class none_model_NA_NA_NA_none_NA_1_model final : public model_base_crtp<none_model_NA_NA_NA_none_NA_1_model> {
private:
int r;
int c;
Eigen::Matrix<double,-1,-1> X_data__;
Eigen::Matrix<double,1,-1> Y_data__;
int index_pos_X_mat_rows;
int index_pos_X_mat_cols;
std::vector<std::vector<int>> index_pos_X_mat;
std::vector<int> index_pos_X_sizes;
int col_index_into_X_first_unique_pos_X_mat_rows;
int col_index_into_X_first_unique_pos_X_mat_cols;
std::vector<std::vector<int>> col_index_into_X_first_unique_pos_X_mat;
std::vector<int> col_index_into_X_first_unique_pos_X_sizes;
int index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows;
int index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols;
std::vector<std::vector<int>> index_of_cZ_for_each_col_in_Z_with_pos_X_mat;
std::vector<int> index_of_cZ_for_each_col_in_Z_with_pos_X_sizes;
int index_neg_X_mat_rows;
int index_neg_X_mat_cols;
std::vector<std::vector<int>> index_neg_X_mat;
std::vector<int> index_neg_X_sizes;
int col_index_into_X_first_unique_neg_X_mat_rows;
int col_index_into_X_first_unique_neg_X_mat_cols;
std::vector<std::vector<int>> col_index_into_X_first_unique_neg_X_mat;
std::vector<int> col_index_into_X_first_unique_neg_X_sizes;
int index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows;
int index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols;
std::vector<std::vector<int>> index_of_cZ_for_each_col_in_Z_with_neg_X_mat;
std::vector<int> index_of_cZ_for_each_col_in_Z_with_neg_X_sizes;
Eigen::Matrix<double,1,-1> zeros_data__;
Eigen::Map<Eigen::Matrix<double,-1,-1>> X{nullptr, 0, 0};
Eigen::Map<Eigen::Matrix<double,1,-1>> Y{nullptr, 0};
Eigen::Map<Eigen::Matrix<double,1,-1>> zeros{nullptr, 0};
public:
~none_model_NA_NA_NA_none_NA_1_model() {}
none_model_NA_NA_NA_none_NA_1_model(stan::io::var_context& context__,
unsigned int random_seed__ = 0,
std::ostream* pstream__ = nullptr)
: model_base_crtp(0) {
int current_statement__ = 0;
using local_scalar_t__ = double;
boost::ecuyer1988 base_rng__ =
stan::services::util::create_rng(random_seed__, 0);
// suppress unused var warning
(void) base_rng__;
static constexpr const char* function__ =
"none_model_NA_NA_NA_none_NA_1_model_namespace::none_model_NA_NA_NA_none_NA_1_model";
// suppress unused var warning
(void) function__;
local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
// suppress unused var warning
(void) DUMMY_VAR__;
try {
int pos__;
pos__ = 1;
current_statement__ = 15;
context__.validate_dims("data initialization", "r", "int",
std::vector<size_t>{});
r = std::numeric_limits<int>::min();
current_statement__ = 15;
r = context__.vals_i("r")[(1 - 1)];
current_statement__ = 16;
context__.validate_dims("data initialization", "c", "int",
std::vector<size_t>{});
c = std::numeric_limits<int>::min();
current_statement__ = 16;
c = context__.vals_i("c")[(1 - 1)];
current_statement__ = 17;
stan::math::validate_non_negative_index("X", "r", r);
current_statement__ = 18;
stan::math::validate_non_negative_index("X", "c", c);
current_statement__ = 19;
context__.validate_dims("data initialization", "X", "double",
std::vector<size_t>{static_cast<size_t>(r), static_cast<size_t>(c)});
X_data__ = Eigen::Matrix<double,-1,-1>::Constant(r, c,
std::numeric_limits<double>::quiet_NaN());
new (&X) Eigen::Map<Eigen::Matrix<double,-1,-1>>(X_data__.data(), r, c);
{
std::vector<local_scalar_t__> X_flat__;
current_statement__ = 19;
X_flat__ = context__.vals_r("X");
current_statement__ = 19;
pos__ = 1;
current_statement__ = 19;
for (int sym1__ = 1; sym1__ <= c; ++sym1__) {
current_statement__ = 19;
for (int sym2__ = 1; sym2__ <= r; ++sym2__) {
current_statement__ = 19;
stan::model::assign(X, X_flat__[(pos__ - 1)],
"assigning variable X", stan::model::index_uni(sym2__),
stan::model::index_uni(sym1__));
current_statement__ = 19;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 20;
stan::math::validate_non_negative_index("Y", "c", c);
current_statement__ = 21;
context__.validate_dims("data initialization", "Y", "double",
std::vector<size_t>{static_cast<size_t>(c)});
Y_data__ = Eigen::Matrix<double,1,-1>::Constant(c,
std::numeric_limits<double>::quiet_NaN());
new (&Y) Eigen::Map<Eigen::Matrix<double,1,-1>>(Y_data__.data(), c);
{
std::vector<local_scalar_t__> Y_flat__;
current_statement__ = 21;
Y_flat__ = context__.vals_r("Y");
current_statement__ = 21;
pos__ = 1;
current_statement__ = 21;
for (int sym1__ = 1; sym1__ <= c; ++sym1__) {
current_statement__ = 21;
stan::model::assign(Y, Y_flat__[(pos__ - 1)],
"assigning variable Y", stan::model::index_uni(sym1__));
current_statement__ = 21;
pos__ = (pos__ + 1);
}
}
current_statement__ = 22;
context__.validate_dims("data initialization", "index_pos_X_mat_rows",
"int", std::vector<size_t>{});
index_pos_X_mat_rows = std::numeric_limits<int>::min();
current_statement__ = 22;
index_pos_X_mat_rows = context__.vals_i("index_pos_X_mat_rows")[(1 -
1)];
current_statement__ = 23;
context__.validate_dims("data initialization", "index_pos_X_mat_cols",
"int", std::vector<size_t>{});
index_pos_X_mat_cols = std::numeric_limits<int>::min();
current_statement__ = 23;
index_pos_X_mat_cols = context__.vals_i("index_pos_X_mat_cols")[(1 -
1)];
current_statement__ = 24;
stan::math::validate_non_negative_index("index_pos_X_mat",
"index_pos_X_mat_rows", index_pos_X_mat_rows);
current_statement__ = 25;
stan::math::validate_non_negative_index("index_pos_X_mat",
"index_pos_X_mat_cols", index_pos_X_mat_cols);
current_statement__ = 26;
context__.validate_dims("data initialization", "index_pos_X_mat",
"int",
std::vector<size_t>{static_cast<size_t>(index_pos_X_mat_rows),
static_cast<size_t>(index_pos_X_mat_cols)});
index_pos_X_mat = std::vector<std::vector<int>>(index_pos_X_mat_rows,
std::vector<int>(index_pos_X_mat_cols,
std::numeric_limits<int>::min()));
{
std::vector<int> index_pos_X_mat_flat__;
current_statement__ = 26;
index_pos_X_mat_flat__ = context__.vals_i("index_pos_X_mat");
current_statement__ = 26;
pos__ = 1;
current_statement__ = 26;
for (int sym1__ = 1; sym1__ <= index_pos_X_mat_cols; ++sym1__) {
current_statement__ = 26;
for (int sym2__ = 1; sym2__ <= index_pos_X_mat_rows; ++sym2__) {
current_statement__ = 26;
stan::model::assign(index_pos_X_mat,
index_pos_X_mat_flat__[(pos__ - 1)],
"assigning variable index_pos_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 26;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 27;
stan::math::validate_non_negative_index("index_pos_X_sizes",
"index_pos_X_mat_rows", index_pos_X_mat_rows);
current_statement__ = 28;
context__.validate_dims("data initialization", "index_pos_X_sizes",
"int",
std::vector<size_t>{static_cast<size_t>(index_pos_X_mat_rows)});
index_pos_X_sizes = std::vector<int>(index_pos_X_mat_rows,
std::numeric_limits<int>::min());
current_statement__ = 28;
index_pos_X_sizes = context__.vals_i("index_pos_X_sizes");
current_statement__ = 29;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_pos_X_mat_rows", "int",
std::vector<size_t>{});
col_index_into_X_first_unique_pos_X_mat_rows = std::numeric_limits<int>::min(
);
current_statement__ = 29;
col_index_into_X_first_unique_pos_X_mat_rows = context__.vals_i("col_index_into_X_first_unique_pos_X_mat_rows")[(1
- 1)];
current_statement__ = 30;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_pos_X_mat_cols", "int",
std::vector<size_t>{});
col_index_into_X_first_unique_pos_X_mat_cols = std::numeric_limits<int>::min(
);
current_statement__ = 30;
col_index_into_X_first_unique_pos_X_mat_cols = context__.vals_i("col_index_into_X_first_unique_pos_X_mat_cols")[(1
- 1)];
current_statement__ = 31;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_pos_X_mat",
"col_index_into_X_first_unique_pos_X_mat_rows",
col_index_into_X_first_unique_pos_X_mat_rows);
current_statement__ = 32;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_pos_X_mat",
"col_index_into_X_first_unique_pos_X_mat_cols",
col_index_into_X_first_unique_pos_X_mat_cols);
current_statement__ = 33;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_pos_X_mat", "int",
std::vector<size_t>{static_cast<size_t>(
col_index_into_X_first_unique_pos_X_mat_rows),
static_cast<size_t>(col_index_into_X_first_unique_pos_X_mat_cols)});
col_index_into_X_first_unique_pos_X_mat = std::vector<std::vector<int>>(col_index_into_X_first_unique_pos_X_mat_rows,
std::vector<int>(col_index_into_X_first_unique_pos_X_mat_cols,
std::numeric_limits<int>::min(
)));
{
std::vector<int> col_index_into_X_first_unique_pos_X_mat_flat__;
current_statement__ = 33;
col_index_into_X_first_unique_pos_X_mat_flat__ = context__.vals_i("col_index_into_X_first_unique_pos_X_mat");
current_statement__ = 33;
pos__ = 1;
current_statement__ = 33;
for (int sym1__ = 1; sym1__ <=
col_index_into_X_first_unique_pos_X_mat_cols; ++sym1__) {
current_statement__ = 33;
for (int sym2__ = 1; sym2__ <=
col_index_into_X_first_unique_pos_X_mat_rows; ++sym2__) {
current_statement__ = 33;
stan::model::assign(col_index_into_X_first_unique_pos_X_mat,
col_index_into_X_first_unique_pos_X_mat_flat__[(pos__ - 1)],
"assigning variable col_index_into_X_first_unique_pos_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 33;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 34;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_pos_X_sizes",
"col_index_into_X_first_unique_pos_X_mat_rows",
col_index_into_X_first_unique_pos_X_mat_rows);
current_statement__ = 35;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_pos_X_sizes", "int",
std::vector<size_t>{static_cast<size_t>(
col_index_into_X_first_unique_pos_X_mat_rows)});
col_index_into_X_first_unique_pos_X_sizes = std::vector<int>(col_index_into_X_first_unique_pos_X_mat_rows,
std::numeric_limits<int>::min(
));
current_statement__ = 35;
col_index_into_X_first_unique_pos_X_sizes = context__.vals_i("col_index_into_X_first_unique_pos_X_sizes");
current_statement__ = 36;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows", "int",
std::vector<size_t>{});
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows = std::numeric_limits<int>::min(
);
current_statement__ = 36;
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows")[(1
- 1)];
current_statement__ = 37;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols", "int",
std::vector<size_t>{});
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols = std::numeric_limits<int>::min(
);
current_statement__ = 37;
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols")[(1
- 1)];
current_statement__ = 38;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows",
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows);
current_statement__ = 39;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols",
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols);
current_statement__ = 40;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat", "int",
std::vector<size_t>{static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows),
static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols)});
index_of_cZ_for_each_col_in_Z_with_pos_X_mat = std::vector<
std::vector<int>>(index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows,
std::vector<int>(index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols,
std::numeric_limits<int>::min(
)));
{
std::vector<int> index_of_cZ_for_each_col_in_Z_with_pos_X_mat_flat__;
current_statement__ = 40;
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_flat__ = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_pos_X_mat");
current_statement__ = 40;
pos__ = 1;
current_statement__ = 40;
for (int sym1__ = 1; sym1__ <=
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_cols; ++sym1__) {
current_statement__ = 40;
for (int sym2__ = 1; sym2__ <=
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows; ++sym2__) {
current_statement__ = 40;
stan::model::assign(index_of_cZ_for_each_col_in_Z_with_pos_X_mat,
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_flat__[(pos__ -
1)],
"assigning variable index_of_cZ_for_each_col_in_Z_with_pos_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 40;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 41;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_pos_X_sizes",
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows",
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows);
current_statement__ = 42;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_pos_X_sizes", "int",
std::vector<size_t>{static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows)});
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes = std::vector<int>(index_of_cZ_for_each_col_in_Z_with_pos_X_mat_rows,
std::numeric_limits<int>::min(
));
current_statement__ = 42;
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_pos_X_sizes");
current_statement__ = 43;
context__.validate_dims("data initialization", "index_neg_X_mat_rows",
"int", std::vector<size_t>{});
index_neg_X_mat_rows = std::numeric_limits<int>::min();
current_statement__ = 43;
index_neg_X_mat_rows = context__.vals_i("index_neg_X_mat_rows")[(1 -
1)];
current_statement__ = 44;
context__.validate_dims("data initialization", "index_neg_X_mat_cols",
"int", std::vector<size_t>{});
index_neg_X_mat_cols = std::numeric_limits<int>::min();
current_statement__ = 44;
index_neg_X_mat_cols = context__.vals_i("index_neg_X_mat_cols")[(1 -
1)];
current_statement__ = 45;
stan::math::validate_non_negative_index("index_neg_X_mat",
"index_neg_X_mat_rows", index_neg_X_mat_rows);
current_statement__ = 46;
stan::math::validate_non_negative_index("index_neg_X_mat",
"index_neg_X_mat_cols", index_neg_X_mat_cols);
current_statement__ = 47;
context__.validate_dims("data initialization", "index_neg_X_mat",
"int",
std::vector<size_t>{static_cast<size_t>(index_neg_X_mat_rows),
static_cast<size_t>(index_neg_X_mat_cols)});
index_neg_X_mat = std::vector<std::vector<int>>(index_neg_X_mat_rows,
std::vector<int>(index_neg_X_mat_cols,
std::numeric_limits<int>::min()));
{
std::vector<int> index_neg_X_mat_flat__;
current_statement__ = 47;
index_neg_X_mat_flat__ = context__.vals_i("index_neg_X_mat");
current_statement__ = 47;
pos__ = 1;
current_statement__ = 47;
for (int sym1__ = 1; sym1__ <= index_neg_X_mat_cols; ++sym1__) {
current_statement__ = 47;
for (int sym2__ = 1; sym2__ <= index_neg_X_mat_rows; ++sym2__) {
current_statement__ = 47;
stan::model::assign(index_neg_X_mat,
index_neg_X_mat_flat__[(pos__ - 1)],
"assigning variable index_neg_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 47;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 48;
stan::math::validate_non_negative_index("index_neg_X_sizes",
"index_neg_X_mat_rows", index_neg_X_mat_rows);
current_statement__ = 49;
context__.validate_dims("data initialization", "index_neg_X_sizes",
"int",
std::vector<size_t>{static_cast<size_t>(index_neg_X_mat_rows)});
index_neg_X_sizes = std::vector<int>(index_neg_X_mat_rows,
std::numeric_limits<int>::min());
current_statement__ = 49;
index_neg_X_sizes = context__.vals_i("index_neg_X_sizes");
current_statement__ = 50;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_neg_X_mat_rows", "int",
std::vector<size_t>{});
col_index_into_X_first_unique_neg_X_mat_rows = std::numeric_limits<int>::min(
);
current_statement__ = 50;
col_index_into_X_first_unique_neg_X_mat_rows = context__.vals_i("col_index_into_X_first_unique_neg_X_mat_rows")[(1
- 1)];
current_statement__ = 51;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_neg_X_mat_cols", "int",
std::vector<size_t>{});
col_index_into_X_first_unique_neg_X_mat_cols = std::numeric_limits<int>::min(
);
current_statement__ = 51;
col_index_into_X_first_unique_neg_X_mat_cols = context__.vals_i("col_index_into_X_first_unique_neg_X_mat_cols")[(1
- 1)];
current_statement__ = 52;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_neg_X_mat",
"col_index_into_X_first_unique_neg_X_mat_rows",
col_index_into_X_first_unique_neg_X_mat_rows);
current_statement__ = 53;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_neg_X_mat",
"col_index_into_X_first_unique_neg_X_mat_cols",
col_index_into_X_first_unique_neg_X_mat_cols);
current_statement__ = 54;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_neg_X_mat", "int",
std::vector<size_t>{static_cast<size_t>(
col_index_into_X_first_unique_neg_X_mat_rows),
static_cast<size_t>(col_index_into_X_first_unique_neg_X_mat_cols)});
col_index_into_X_first_unique_neg_X_mat = std::vector<std::vector<int>>(col_index_into_X_first_unique_neg_X_mat_rows,
std::vector<int>(col_index_into_X_first_unique_neg_X_mat_cols,
std::numeric_limits<int>::min(
)));
{
std::vector<int> col_index_into_X_first_unique_neg_X_mat_flat__;
current_statement__ = 54;
col_index_into_X_first_unique_neg_X_mat_flat__ = context__.vals_i("col_index_into_X_first_unique_neg_X_mat");
current_statement__ = 54;
pos__ = 1;
current_statement__ = 54;
for (int sym1__ = 1; sym1__ <=
col_index_into_X_first_unique_neg_X_mat_cols; ++sym1__) {
current_statement__ = 54;
for (int sym2__ = 1; sym2__ <=
col_index_into_X_first_unique_neg_X_mat_rows; ++sym2__) {
current_statement__ = 54;
stan::model::assign(col_index_into_X_first_unique_neg_X_mat,
col_index_into_X_first_unique_neg_X_mat_flat__[(pos__ - 1)],
"assigning variable col_index_into_X_first_unique_neg_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 54;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 55;
stan::math::validate_non_negative_index(
"col_index_into_X_first_unique_neg_X_sizes",
"col_index_into_X_first_unique_neg_X_mat_rows",
col_index_into_X_first_unique_neg_X_mat_rows);
current_statement__ = 56;
context__.validate_dims("data initialization",
"col_index_into_X_first_unique_neg_X_sizes", "int",
std::vector<size_t>{static_cast<size_t>(
col_index_into_X_first_unique_neg_X_mat_rows)});
col_index_into_X_first_unique_neg_X_sizes = std::vector<int>(col_index_into_X_first_unique_neg_X_mat_rows,
std::numeric_limits<int>::min(
));
current_statement__ = 56;
col_index_into_X_first_unique_neg_X_sizes = context__.vals_i("col_index_into_X_first_unique_neg_X_sizes");
current_statement__ = 57;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows", "int",
std::vector<size_t>{});
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows = std::numeric_limits<int>::min(
);
current_statement__ = 57;
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows")[(1
- 1)];
current_statement__ = 58;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols", "int",
std::vector<size_t>{});
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols = std::numeric_limits<int>::min(
);
current_statement__ = 58;
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols")[(1
- 1)];
current_statement__ = 59;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows",
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows);
current_statement__ = 60;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols",
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols);
current_statement__ = 61;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat", "int",
std::vector<size_t>{static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows),
static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols)});
index_of_cZ_for_each_col_in_Z_with_neg_X_mat = std::vector<
std::vector<int>>(index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows,
std::vector<int>(index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols,
std::numeric_limits<int>::min(
)));
{
std::vector<int> index_of_cZ_for_each_col_in_Z_with_neg_X_mat_flat__;
current_statement__ = 61;
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_flat__ = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_neg_X_mat");
current_statement__ = 61;
pos__ = 1;
current_statement__ = 61;
for (int sym1__ = 1; sym1__ <=
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_cols; ++sym1__) {
current_statement__ = 61;
for (int sym2__ = 1; sym2__ <=
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows; ++sym2__) {
current_statement__ = 61;
stan::model::assign(index_of_cZ_for_each_col_in_Z_with_neg_X_mat,
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_flat__[(pos__ -
1)],
"assigning variable index_of_cZ_for_each_col_in_Z_with_neg_X_mat",
stan::model::index_uni(sym2__), stan::model::index_uni(sym1__));
current_statement__ = 61;
pos__ = (pos__ + 1);
}
}
}
current_statement__ = 62;
stan::math::validate_non_negative_index(
"index_of_cZ_for_each_col_in_Z_with_neg_X_sizes",
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows",
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows);
current_statement__ = 63;
context__.validate_dims("data initialization",
"index_of_cZ_for_each_col_in_Z_with_neg_X_sizes", "int",
std::vector<size_t>{static_cast<size_t>(
index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows)});
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes = std::vector<int>(index_of_cZ_for_each_col_in_Z_with_neg_X_mat_rows,
std::numeric_limits<int>::min(
));
current_statement__ = 63;
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes = context__.vals_i("index_of_cZ_for_each_col_in_Z_with_neg_X_sizes");
current_statement__ = 64;
stan::math::validate_non_negative_index("zeros", "c", c);
current_statement__ = 65;
zeros_data__ = Eigen::Matrix<double,1,-1>::Constant(c,
std::numeric_limits<double>::quiet_NaN());
new (&zeros)
Eigen::Map<Eigen::Matrix<double,1,-1>>(zeros_data__.data(), c);
current_statement__ = 65;
stan::model::assign(zeros, stan::math::zeros_row_vector(c),
"assigning variable zeros");
current_statement__ = 66;
stan::math::validate_non_negative_index("beta", "r", r);
} catch (const std::exception& e) {
stan::lang::rethrow_located(e, locations_array__[current_statement__]);
}
num_params_r__ = r;
}
inline std::string model_name() const final {
return "none_model_NA_NA_NA_none_NA_1_model";
}
inline std::vector<std::string> model_compile_info() const noexcept {
return std::vector<std::string>{"stanc_version = stanc3 v2.31.0-68-gbd516d56",
"stancflags = --O1 --name=none_model_NA_NA_NA_none_NA_1_model"};
}
template <bool propto__, bool jacobian__, typename VecR, typename VecI,
stan::require_vector_like_t<VecR>* = nullptr,
stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr>
inline stan::scalar_type_t<VecR>
log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream*
pstream__ = nullptr) const {
using T__ = stan::scalar_type_t<VecR>;
using local_scalar_t__ = T__;
T__ lp__(0.0);
stan::math::accumulator<T__> lp_accum__;
stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
int current_statement__ = 0;
local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
// suppress unused var warning
(void) DUMMY_VAR__;
static constexpr const char* function__ =
"none_model_NA_NA_NA_none_NA_1_model_namespace::log_prob";
// suppress unused var warning
(void) function__;
try {
Eigen::Matrix<local_scalar_t__,-1,1> beta;
current_statement__ = 1;
beta = in__.template read<Eigen::Matrix<local_scalar_t__,-1,1>>(r);
{
current_statement__ = 2;
stan::math::validate_non_negative_index("Z_mike", "c", c);
stan::conditional_var_value_t<local_scalar_t__,
Eigen::Matrix<local_scalar_t__,1,-1>> Z_mike =
stan::conditional_var_value_t<local_scalar_t__,
Eigen::Matrix<local_scalar_t__,1,-1>>(Eigen::Matrix<double,1,-1>::Constant(c,
std::numeric_limits<double>::quiet_NaN(
)));
current_statement__ = 12;
{
stan::math::profile<local_scalar_t__> profile__("mike",
const_cast<stan::math::profile_map&>(profiles__));
stan::conditional_var_value_t<local_scalar_t__,
Eigen::Matrix<local_scalar_t__,1,-1>>
inline_mike_dot_return_sym1__;
{
current_statement__ = 4;
stan::math::validate_non_negative_index("out", "c", c);
stan::conditional_var_value_t<local_scalar_t__,
Eigen::Matrix<local_scalar_t__,1,-1>>
inline_mike_dot_out_sym2__;
current_statement__ = 5;
stan::model::assign(inline_mike_dot_out_sym2__, zeros,
"assigning variable inline_mike_dot_out_sym2__");
current_statement__ = 9;
for (int inline_mike_dot_i_r_sym3__ = 1; inline_mike_dot_i_r_sym3__
<= r; ++inline_mike_dot_i_r_sym3__) {
current_statement__ = 6;
stan::model::assign(inline_mike_dot_out_sym2__,
stan::model::rvalue(
stan::math::add(
stan::model::deep_copy(
stan::model::rvalue(inline_mike_dot_out_sym2__,
"inline_mike_dot_out_sym2__",
stan::model::index_multi(
stan::model::rvalue(
col_index_into_X_first_unique_pos_X_mat,
"col_index_into_X_first_unique_pos_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
col_index_into_X_first_unique_pos_X_sizes[(inline_mike_dot_i_r_sym3__
- 1)]))))), beta[(inline_mike_dot_i_r_sym3__ -
1)]),
"(FnDeepCopy__(inline_mike_dot_out_sym2__[col_index_into_X_first_unique_pos_X_mat\n [inline_mike_dot_i_r_sym3__,\n 1:col_index_into_X_first_unique_pos_X_sizes\n [inline_mike_dot_i_r_sym3__]]]) + \nbeta[inline_mike_dot_i_r_sym3__])",
stan::model::index_multi(
stan::model::rvalue(
index_of_cZ_for_each_col_in_Z_with_pos_X_mat,
"index_of_cZ_for_each_col_in_Z_with_pos_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
index_of_cZ_for_each_col_in_Z_with_pos_X_sizes[(inline_mike_dot_i_r_sym3__
- 1)])))),
"assigning variable inline_mike_dot_out_sym2__",
stan::model::index_multi(
stan::model::rvalue(index_pos_X_mat, "index_pos_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
index_pos_X_sizes[(inline_mike_dot_i_r_sym3__ - 1)]))));
current_statement__ = 7;
stan::model::assign(inline_mike_dot_out_sym2__,
stan::model::rvalue(
stan::math::subtract(
stan::model::deep_copy(
stan::model::rvalue(inline_mike_dot_out_sym2__,
"inline_mike_dot_out_sym2__",
stan::model::index_multi(
stan::model::rvalue(
col_index_into_X_first_unique_neg_X_mat,
"col_index_into_X_first_unique_neg_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
col_index_into_X_first_unique_neg_X_sizes[(inline_mike_dot_i_r_sym3__
- 1)]))))), beta[(inline_mike_dot_i_r_sym3__ -
1)]),
"(FnDeepCopy__(inline_mike_dot_out_sym2__[col_index_into_X_first_unique_neg_X_mat\n [inline_mike_dot_i_r_sym3__,\n 1:col_index_into_X_first_unique_neg_X_sizes\n [inline_mike_dot_i_r_sym3__]]]) - \nbeta[inline_mike_dot_i_r_sym3__])",
stan::model::index_multi(
stan::model::rvalue(
index_of_cZ_for_each_col_in_Z_with_neg_X_mat,
"index_of_cZ_for_each_col_in_Z_with_neg_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
index_of_cZ_for_each_col_in_Z_with_neg_X_sizes[(inline_mike_dot_i_r_sym3__
- 1)])))),
"assigning variable inline_mike_dot_out_sym2__",
stan::model::index_multi(
stan::model::rvalue(index_neg_X_mat, "index_neg_X_mat",
stan::model::index_uni(inline_mike_dot_i_r_sym3__),
stan::model::index_min_max(1,
index_neg_X_sizes[(inline_mike_dot_i_r_sym3__ - 1)]))));
}
current_statement__ = 10;
stan::model::assign(inline_mike_dot_return_sym1__,
inline_mike_dot_out_sym2__,
"assigning variable inline_mike_dot_return_sym1__");
}
stan::model::assign(Z_mike, inline_mike_dot_return_sym1__,
"assigning variable Z_mike");
}
current_statement__ = 13;
lp_accum__.add(stan::math::std_normal_lpdf<propto__>(beta));
current_statement__ = 14;
lp_accum__.add(stan::math::normal_lpdf<propto__>(Y, Z_mike, 1.0));
}
} catch (const std::exception& e) {
stan::lang::rethrow_located(e, locations_array__[current_statement__]);
}
lp_accum__.add(lp__);
return lp_accum__.sum();
}
template <typename RNG, typename VecR, typename VecI, typename VecVar,
stan::require_vector_like_vt<std::is_floating_point,
VecR>* = nullptr, stan::require_vector_like_vt<std::is_integral,
VecI>* = nullptr, stan::require_vector_vt<std::is_floating_point,
VecVar>* = nullptr>
inline void
write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__,
VecVar& vars__, const bool
emit_transformed_parameters__ = true, const bool
emit_generated_quantities__ = true, std::ostream*
pstream__ = nullptr) const {
using local_scalar_t__ = double;
stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
stan::io::serializer<local_scalar_t__> out__(vars__);
static constexpr bool propto__ = true;
// suppress unused var warning
(void) propto__;
double lp__ = 0.0;
// suppress unused var warning
(void) lp__;
int current_statement__ = 0;
stan::math::accumulator<double> lp_accum__;
local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
// suppress unused var warning
(void) DUMMY_VAR__;
constexpr bool jacobian__ = false;
static constexpr const char* function__ =
"none_model_NA_NA_NA_none_NA_1_model_namespace::write_array";
// suppress unused var warning
(void) function__;
try {
Eigen::Matrix<double,-1,1> beta;
current_statement__ = 1;
beta = in__.template read<Eigen::Matrix<local_scalar_t__,-1,1>>(r);
out__.write(beta);
if (stan::math::logical_negation(
(stan::math::primitive_value(emit_transformed_parameters__) ||
stan::math::primitive_value(emit_generated_quantities__)))) {
return ;
}
if (stan::math::logical_negation(emit_generated_quantities__)) {
return ;
}
} catch (const std::exception& e) {
stan::lang::rethrow_located(e, locations_array__[current_statement__]);
}
}
template <typename VecVar, typename VecI,
stan::require_vector_t<VecVar>* = nullptr,
stan::require_vector_like_vt<std::is_integral, VecI>* = nullptr>
inline void
transform_inits_impl(VecVar& params_r__, VecI& params_i__, VecVar& vars__,
std::ostream* pstream__ = nullptr) const {
using local_scalar_t__ = double;
stan::io::deserializer<local_scalar_t__> in__(params_r__, params_i__);
stan::io::serializer<local_scalar_t__> out__(vars__);
int current_statement__ = 0;
local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
// suppress unused var warning
(void) DUMMY_VAR__;
try {
int pos__;
pos__ = 1;
Eigen::Matrix<local_scalar_t__,-1,1> beta =
Eigen::Matrix<local_scalar_t__,-1,1>::Constant(r, DUMMY_VAR__);
for (int sym1__ = 1; sym1__ <= r; ++sym1__) {
stan::model::assign(beta, in__.read<local_scalar_t__>(),
"assigning variable beta", stan::model::index_uni(sym1__));
}
out__.write(beta);
} catch (const std::exception& e) {
stan::lang::rethrow_located(e, locations_array__[current_statement__]);
}
}
inline void get_param_names(std::vector<std::string>& names__) const {
names__ = std::vector<std::string>{"beta"};
}
inline void get_dims(std::vector<std::vector<size_t>>& dimss__) const {
dimss__ = std::vector<std::vector<size_t>>{std::vector<size_t>{static_cast<
size_t>(r)}};
}
inline void
constrained_param_names(std::vector<std::string>& param_names__, bool
emit_transformed_parameters__ = true, bool
emit_generated_quantities__ = true) const final {
for (int sym5__ = 1; sym5__ <= r; ++sym5__) {
param_names__.emplace_back(std::string() + "beta" + '.' +
std::to_string(sym5__));
}
if (emit_transformed_parameters__) {}
if (emit_generated_quantities__) {}
}
inline void
unconstrained_param_names(std::vector<std::string>& param_names__, bool
emit_transformed_parameters__ = true, bool
emit_generated_quantities__ = true) const final {
for (int sym5__ = 1; sym5__ <= r; ++sym5__) {
param_names__.emplace_back(std::string() + "beta" + '.' +
std::to_string(sym5__));
}
if (emit_transformed_parameters__) {}
if (emit_generated_quantities__) {}
}
inline std::string get_constrained_sizedtypes() const {
return std::string("[{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(r) + "},\"block\":\"parameters\"}]");
}
inline std::string get_unconstrained_sizedtypes() const {
return std::string("[{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(r) + "},\"block\":\"parameters\"}]");
}
// Begin method overload boilerplate
template <typename RNG> inline void
write_array(RNG& base_rng, Eigen::Matrix<double,-1,1>& params_r,
Eigen::Matrix<double,-1,1>& vars, const bool
emit_transformed_parameters = true, const bool
emit_generated_quantities = true, std::ostream*
pstream = nullptr) const {
const size_t num_params__ = r;
const size_t num_transformed = emit_transformed_parameters * (0);
const size_t num_gen_quantities = emit_generated_quantities * (0);
const size_t num_to_write = num_params__ + num_transformed +
num_gen_quantities;
std::vector<int> params_i;
vars = Eigen::Matrix<double,-1,1>::Constant(num_to_write,
std::numeric_limits<double>::quiet_NaN());
write_array_impl(base_rng, params_r, params_i, vars,
emit_transformed_parameters, emit_generated_quantities, pstream);
}
template <typename RNG> inline void
write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
params_i, std::vector<double>& vars, bool
emit_transformed_parameters = true, bool
emit_generated_quantities = true, std::ostream*
pstream = nullptr) const {
const size_t num_params__ = r;
const size_t num_transformed = emit_transformed_parameters * (0);
const size_t num_gen_quantities = emit_generated_quantities * (0);
const size_t num_to_write = num_params__ + num_transformed +
num_gen_quantities;
vars = std::vector<double>(num_to_write,
std::numeric_limits<double>::quiet_NaN());
write_array_impl(base_rng, params_r, params_i, vars,
emit_transformed_parameters, emit_generated_quantities, pstream);
}
template <bool propto__, bool jacobian__, typename T_> inline T_
log_prob(Eigen::Matrix<T_,-1,1>& params_r, std::ostream* pstream = nullptr) const {
Eigen::Matrix<int,-1,1> params_i;
return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
}
template <bool propto__, bool jacobian__, typename T_> inline T_
log_prob(std::vector<T_>& params_r, std::vector<int>& params_i,
std::ostream* pstream = nullptr) const {
return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
}
inline void
transform_inits(const stan::io::var_context& context,
Eigen::Matrix<double,-1,1>& params_r, std::ostream*
pstream = nullptr) const final {
std::vector<double> params_r_vec(params_r.size());
std::vector<int> params_i;
transform_inits(context, params_i, params_r_vec, pstream);
params_r = Eigen::Map<Eigen::Matrix<double,-1,1>>(params_r_vec.data(),
params_r_vec.size());
}
inline void
transform_inits(const stan::io::var_context& context, std::vector<int>&
params_i, std::vector<double>& vars, std::ostream*
pstream__ = nullptr) const {
constexpr std::array<const char*, 1> names__{"beta"};
const std::array<Eigen::Index, 1> constrain_param_sizes__{r};
const auto num_constrained_params__ =
std::accumulate(constrain_param_sizes__.begin(),
constrain_param_sizes__.end(), 0);
std::vector<double> params_r_flat__(num_constrained_params__);
Eigen::Index size_iter__ = 0;
Eigen::Index flat_iter__ = 0;
for (auto&& param_name__: names__) {
const auto param_vec__ = context.vals_r(param_name__);
for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) {
params_r_flat__[flat_iter__] = param_vec__[i];
++flat_iter__;
}
++size_iter__;
}
vars.resize(num_params_r__);
transform_inits_impl(params_r_flat__, params_i, vars, pstream__);
}
};
}
using stan_model = none_model_NA_NA_NA_none_NA_1_model_namespace::none_model_NA_NA_NA_none_NA_1_model;
#ifndef USING_R
// Boilerplate
stan::model::model_base&
new_model(stan::io::var_context& data_context, unsigned int seed,
std::ostream* msg_stream) {
stan_model* m = new stan_model(data_context, seed, msg_stream);
return *m;
}
stan::math::profile_map& get_stan_profile_data() {
return none_model_NA_NA_NA_none_NA_1_model_namespace::profiles__;
}
#endif |
If it compiles and runs then it seems like that warning is due to an implementation detail of cmdstanr |
Just realized that reading/pasting might not have kept the incomplete line the warning refers to, so attaching the file (with a txt extension to get past the file format filter) |
oh, and yes, it samples without error too. |
This is related to #1280 but is probably not the cause. It was also reported in this forum thread by @mike-lawrence
Submission Checklist
Release notes
Fixes an issue where
profile
blocks could generate uncompilable C++ when used with--O1
.Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)