From: Vijay S. <vi...@sa...> - 2017-05-08 17:12:38
|
Interesting that Stan, a C++ based probabilistic programing language, implemented a version of constrained types. Stan: A Probabilistic Programming Language http://www.stat.columbia.edu/~gelman/research/published/stan-paper-revision-feb2015.pdf ----- Variables may be declared with constraints. The constraints have different effects depending on the block in which the variable is declared. Integer and real types may be provided with lower bounds, upper bounds, or both. This includes the types used in arrays, and the real types used in vectors and matrices. Vector types may be constrained to be unit simplexes (all entries non-negative and summing to 1), unit length vectors (sum of squares is 1), or ordered (entries are in ascending order), positive ordered (entries in ascending order, all non-negative), using the types simplex[K], unit_vector[K], ordered[K], or positive_ordered[K], where K is the size of the vector. Matrices may be constrained to be covariance matrices (symmetric, positive definite) or corre- lation matrices (symmetric, positive definite, unit diagonal), using the types cov_matrix[K] and corr_matrix[K]. ----- |