-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from stan-dev/feature/standalone_functions
Feature/standalone functions
- Loading branch information
Showing
9 changed files
with
848 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/integration/good/code-gen/standalone_functions/basic.stan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
functions { | ||
real my_log1p_exp(real x) { | ||
return log1p_exp(x); | ||
} | ||
|
||
real array_fun(real[] a) | ||
{ | ||
return sum(a); | ||
} | ||
|
||
real int_array_fun(int[] a) | ||
{ | ||
return sum(a); | ||
} | ||
|
||
vector my_vector_mul_by_5(vector x) | ||
{ | ||
vector[num_elements(x)] result = x * 5.0; | ||
return result; | ||
} | ||
|
||
int int_only_multiplication(int a, int b) { | ||
return a*b; | ||
} | ||
|
||
real test_lgamma(real x) { | ||
return lgamma(x); | ||
} | ||
|
||
// test special functions | ||
void test_lp(real a) { | ||
a ~ normal(0, 1); | ||
} | ||
|
||
real test_rng(real a) { | ||
return normal_rng(a, 1); | ||
} | ||
|
||
real test_lpdf(real a, real b) { | ||
return normal_lpdf(a | b, 1); | ||
} | ||
} | ||
|
Oops, something went wrong.