Analysis_and_optimization.Pedantic_dist_warnings
type compiletime_val =
| Opaque
| Number of float * string
| Param of string * Middle.Expr.Typed.t Middle.Transformation.t
| Data of string
Useful information about an expression. Opaque
means we don't know anything.
type dist_info = {
name : string;
loc : Middle.Location_span.t;
args : (compiletime_val * Middle.Expr.Typed.Meta.t) Core.List.t;
}
Info about a distribution occurrences that's useful for checking that distribution properties are met
Value constraint as a range. The bools are true if the bound is inclusive
type var_constraint =
| Range of range
| Ordered
| PositiveOrdered
| Simplex
| UnitVector
| CholeskyCorr
| CholeskyCov
| Correlation
| Covariance
Value constraint for an argument
Constraint paired with a name for user messages
val unit_range : var_constraint_named
val exclusive_unit_range : var_constraint_named
val positive_range : var_constraint_named
val nonnegative_range : var_constraint_named
val simplex : var_constraint_named
val ordered : var_constraint_named
val correlation : var_constraint_named
val cholesky_correlation : var_constraint_named
val covariance : var_constraint_named
val cholesky_covariance : var_constraint_named
val bounds_out_of_range : range -> Mir_utils.bound_values -> bool
Check for inconsistency between a distribution argument's value range and the declared bounds of a variable
val transform_mismatch_constraint :
var_constraint ->
Middle.Expr.Typed.t Middle.Transformation.t ->
bool
Check for inconsistency between a distribution argument's constraint and the constraint transformation of a variable
val value_out_of_range : range -> float -> bool
Check for inconsistency between a distribution argument's range and a literal value
val value_mismatch_constraint : var_constraint -> float -> bool
Check for inconsistency between a distribution argument's constraint and a literal value
val arg_number : arg_info -> int
val constr_mismatch_message : string -> string -> arg_info -> string -> string
val constr_literal_mismatch_message :
string ->
string ->
arg_info ->
string ->
string
val constr_mismatch_warning :
var_constraint_named ->
arg_info ->
dist_info ->
(Middle.Location_span.t * string) option
Return a warning if the argn-th argument doesn't match its constraints
val uniform_dist_warning :
dist_info ->
(Middle.Location_span.t * string) option
Warning for all uniform distributions with a parameter
val lkj_corr_dist_warning :
dist_info ->
(Middle.Location_span.t * string) option
Warn about all non-Cholesky lkj_corr distributions
val gamma_arg_dist_warning :
dist_info ->
(Middle.Location_span.t * string) option
Warning particular to gamma and inv_gamma, when A=B<1
val distribution_warning :
dist_info ->
(Middle.Location_span.t * string) Core.List.t
Generate all of the warnings that are relevant to a given distribution
val distribution_warnings :
dist_info Core.Set.Poly.t ->
(Middle.Location_span.t * string) Core.Set.Poly.t
Generate the distribution warnings for a program