This function checks whether the input is a real vector with non-negative entries that add up to one.
check_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))assert_probability_vector(
x,
len = NULL,
tolerance = sqrt(.Machine$double.eps),
.var.name = checkmate::vname(x),
add = NULL
)
test_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))
Compare to check_numeric
.
Object to check.
[integer(1)
]
Exact expected length of x
.
A non-negative numeric
tolerance value.
[character(1)
]
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in vname
.
[AssertCollection
]
Collection to store assertion messages. See AssertCollection
.