stan
stan copied to clipboard
Reimplementation of ordered_free/positive_ordered_free in stan::io
Summary:
stan::io reimplements its own versions of ordered_free (https://github.com/stan-dev/stan/blob/develop/src/stan/io/writer.hpp#L211) and positive_ordered_free (https://github.com/stan-dev/stan/blob/develop/src/stan/io/writer.hpp#L237) instead of using the stuff in the math library
I assigned it to you @syclik to evaluate it. If you certify its bugishness, kick it back to me and I'll make a pull with a fix.
Description:
There's a comment in the code about avoiding a malloc (https://github.com/stan-dev/stan/blob/develop/src/stan/io/writer.hpp#L240). In a situation like this I'd say that calls switching to a faster malloc instead of using some transforms that probly aren't nearly as tested as the math lib ones.
This appears to have been a source of a bug as of 2017: https://github.com/stan-dev/stan/commit/b29cb9bf3aa0a2f148684cbf02a8a3dfae26f291#diff-8514db1885e9892241747a15714efa75
This seems to have been in place since at least 2013: https://github.com/stan-dev/stan/commit/f718dc9d004580c34d8d33d5e050e565bf47a439#diff-8514db1885e9892241747a15714efa75
so I think it's fair to revisit the decision.
Current Version:
v2.18.0