| Action |
Code |
Details |
|
Declare unconstrainted integer variable
|
|
|
|
Declare constrained integer variable
|
int<lower=1, upper=10> n;
|
|
|
Declare unconstrained float variable
|
|
|
|
Declare unconstrained float with value
|
|
|
|
Declare unconstrained float variable as NaN
|
|
|
|
Declare constrained float variable
|
real<lower=0, upper=1> prob;
|
|
| Action |
Code |
Details |
|
Absolute value
|
|
|
|
Threshold (step)
|
|
0 if x < 0, else 1 |
|
Addition
|
|
|
|
Subtraction (difference)
|
|
|
|
Positive difference
|
|
x - y for x >= y, else 0 |
|
Absolute difference
|
|
|
|
Multiplication
|
|
|
|
Division
|
|
|
|
Reciprocal
|
|
1 / x |
|
Multiplication followed by addition of z
|
|
x * y + z |
|
Square (power of 2)
|
|
x ^ 2 |
|
Inverse square (power of -2)
|
|
x ^ -2 |
|
Square root
|
|
|
|
Inverse square root
|
|
1 / sqrt(x) |
|
Cube root
|
|
pow(x, 1/3) |
|
Raise to power p
|
|
|
|
Raise to power p
|
|
|
|
Natural logarithm
|
|
|
|
Base-2 logarithm
|
|
|
|
Base-10 logarithm
|
|
|
|
Natural logarithm of reciprocal
|
|
log(1/x) |
|
Natural logarithm of (1 - x)
|
|
log(1 - x) |
|
Natural logarithm of 1 - exp(x)
|
|
log(1 - e^x) |
|
Natural logarithm of (1 + x)
|
|
log(1 + x) |
|
Natural logarithm of 1 + exp(x)
|
|
log(1 + e^x) |
|
Multiplication with log
|
|
p * log(x) for x > 0 |
|
Natural exponential
|
|
|
|
Natural exponential of x - 1
|
|
(e^x) - 1 |
|
Min
|
|
|
|
Max
|
|
|
|
Modulus
|
|
x - floor(x / y) * y |
|
Floor
|
|
|
|
Ceil
|
|
|
|
Round
|
|
Output is real |
|
Truncate to nearest integer
|
|
Output is real |
|
Log-sum of exponentials
|
|
log(e^x + e^y) |
|
Log-diff of exponentials
|
|
log(e^x - e^y) for x > y |
|
Proportional log-sum of exponentials (used for mixtures)
|
|
log(theta * e^x + (1 - theta) * e^y) |
|
Proportional log-sum of exponentials (used for mixtures)
|
log_sum_exp(theta + [x, y])
|
|
|
Proportional log-sum of exponentials (used for mixtures)
|
log_sum_exp(log(theta) + x, log1m(theta) + y)
|
|
|
Logit transform
|
|
|
|
Inverse logit transform
|
|
|
|
Natural logarithm of inverse logit
|
|
|
|
Natural logarithm of 1 minus inverse logit
|
|
|
|
Binomial coefficient (ncr)
|
|
|