where functions go:

18 views
Skip to first unread message

Bob Carpenter

unread,
Aug 8, 2016, 1:46:48 PM8/8/16
to stan...@googlegroups.com
I added a note to the function implementation page explaining
where to put function imlementation files:

https://github.com/stan-dev/stan/wiki/Contributing-New-Functions-to-Stan

- Bob

P.S. Here's what I added:


Directories for code
--------------------

In general, implementations should go int the lowest directory possible, subject to the orderings

scal < arr < mat

prim < rev < mix;

prim < fwd < mix;

If the left-hand type occurs, the directory has to be at least the minimum on the right

Code includes directory must be at least
------------- --------------------------
Eigen::Matrix mat
std::vector arr
stan::math::rev rev
stan::math::fwd fwd

Everything else follows from these two rules. The directories are laid out two deep, with

(prim | fwd | rev | mix) / (scal | arr | mat)

...

Depending on where you put the function (see the rules above), you'll need to include its definition file in the appropriate header include to make sure it's visible to models. For instance, if the function is going into `stan/math/rev/arr/foo.hpp` then `#include <stan/math/rev/arr/foo.hpp>` should be included added to `stan/math/rev/arr.hpp`.

Krzysztof Sakrejda

unread,
Aug 8, 2016, 3:46:41 PM8/8/16
to stan development mailing list
Thanks. Very helpful to have it laid out!.

Daniel Lee

unread,
Aug 8, 2016, 3:49:49 PM8/8/16
to stan-dev mailing list
Thanks, Bob!


Daniel


On Mon, Aug 8, 2016 at 3:46 PM, Krzysztof Sakrejda <krzysztof...@gmail.com> wrote:
Thanks. Very helpful to have it laid out!.

--
You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages