Resize function

Does anyone know if the resize function (defined here: https://github.com/stan-dev/math/blob/develop/stan/math/prim/mat/fun/resize.hpp) is being used anywhere?

I grepped around in the Stan repo and the Math repo and it only appears in the Math test functions.

I need a function similar to this, but with some slight modifications, so I wanted to adopt it if nobody else was using it for anything (to avoid having another similar, but incompatible function floating around).

For what it’s worth, I want to change it to be compatible with the dims function. Dims works with std::vector<ints> and resize uses std::vector<size_t> instead (meaning I gotta do an annoying manual cast to int to get it to work). Secondly a row vector with N columns has dims {N, 1} but resize (as currently coded) expects just {N}.

If you can’t find it by grepping, it’s not being used. You want to check the stan-dev/stan repo, too, not just stan-dev/math. We occassionally drop things in the math lib that we need.

Given your proposed modifications, I would instead suggest just overloading it to take different kinds of arguments. Most of the Eigen mechanisms let you optionally specify size 1 for vector rows or row vector columns.