DelayExpression
abstract class DelayExpression
Value-agnostic interface for expressions.
- isConstant: Is this a constant expression?
Member Variables
Name | Description |
---|---|
generation:Integer | Generation in which the expression was evaluated. This is zero unless pilot() has been called with a given generation provided, and the expression has not subsequently been made constant (in which case it reverts to zero). |
pilotCount:Integer16 | Number of times pilot() has been called. |
gradCount:Integer16 | Number of times grad() or move() has been called. In the former case, used to track accumulation of upstream gradients before recursion, after which it is reset to zero. In the latter case, used to ensure that each subexpression is moved only once, and upon reaching pilotCount is reset to zero. |
flagConstant:Boolean | Has value() been called? This is used as a short-circuit for shared subexpressions. |
flagPrior:Boolean | Has prior() been called? This is used as a short-circuit for shared subexpressions. |
Member Functions
Name | Description |
---|---|
isRandom | Is this a Random expression? |
isConstant | Is this a constant expression? |
length | Length of result. |
rows | Number of rows in result. |
columns | Number of columns in result. |
depth | Depth of the expression tree. |
prior | Construct a lazy expression for the log-prior, and collect variables. |
Member Function Details
columns
abstract function columns() -> Integer
Number of columns in result.
depth
abstract function depth() -> Integer
Depth of the expression tree.
isConstant
function isConstant() -> Boolean
Is this a constant expression?
isRandom
function isRandom() -> Boolean
Is this a Random expression?
length
final function length() -> Integer
Length of result. This is synonymous with rows()
.
prior
final function prior() -> Expression<Real>?
Construct a lazy expression for the log-prior, and collect variables.
Returns: An expression giving the log-prior of any variables in the expression, or nil if there are no variables (which may be interpreted as a log-prior of zero).
rows
abstract function rows() -> Integer
Number of rows in result.