Adding functions into stan language

There are two GLMs (ordered_logistic_glm_lpdf() and categorical_logistic_glm_lpdf()) I implemented that were merged into stan math, but are not yet part of stan language. What needs to be done for them to be added to the language?

@seantalts Does it even make sense to add support for them into old compiler, or would that just duplicate work? Should we add them only to new compiler?

Add them in (from command Stan) /stan/src/stan/lang/function_signatures.h, add some instantiation tests in stan/src/test/test-models/good/function-signatures/math/[whatever directory they belong]/[filename].stan.

Go ahead and compile the stan models with command stan to make sure they don’t bug

It would be duplicate work - we’re aiming to switch CmdStan over in the next release and have mostly been avoiding adding new stuff to the old compiler.

I think I’m going to be adding a new function to the language as a documentary exemplar PR and maybe even a youtube video about it. I’ll do that this morning and send it out.


I went ahead and made an exemplar PR and recorded myself doing this live for posterity 😬😬😬


I already forgot to add one thing, which is the tests for the Stan math signatures expected file. Ugh.


But all told the whole thing only took 13 minutes, even explaining myself and doing it live and whatnot.

I need to make separate videos for:

  1. getting the dev environment up and running
  2. explaining the architecture

This is really nice. Beats doc any day of the week :)

It would be a bit fast paced for someone not familiar with the ins and outs of the compiler. If it would be the 3rd part of the videos you mention below it would be perfect.

Yeah, I was thinking it’d be nice if there were a few shorter video tutorials. Maybe you and I can go through the dev environment and architecture together and chop both of those off into their own separate videos.

I’m not sure how much time to spend on planning it out and explanations. I think a few thought-out videos as doc are nice, and then I was thinking I might just stream a bunch of myself programming stuff I was going to do anyway in the off chance that helps someone, haha.

I uploaded a version with better sound:

1 Like