how can I convert a real to an int. I want to round

int x;

x = a * b;

where a and b and reals

how can I convert a real to an int. I want to round

int x;

x = a * b;

where a and b and reals

Stan speed drastically decreases when adding one extra parameter

Are you trying to do some kind of interpolation problem? That’s the only example we’ve seen where this would be useful and not violate continuous differentiability for the posterior. But we’ve never gotten around to building in an interpolation.

Just keep in mind that the posterior should be continuously differentiable. You can write an inefficient linear function to truncate or a more efficient logarithmetic one with binary search, but however you do it, it’s going to break differentiability w.r.t. the integer.

You can also allocate things that are larger and only use some of them if it’s just a placeholder. But no way to get it the right size without hacking.