Sequoia
|
Validators are central to dealing with spaces where the C++ representation could produce values outside the underlying set. More...
Concepts | |
concept | sequoia::maths::validator_for |
concept to check if a validator is compatible with a convex space. | |
Classes | |
struct | sequoia::maths::is_identity_validator< T > |
Trait for validators that behave like the identity. More... | |
struct | sequoia::maths::half_line_validator |
A validator the the half line. More... | |
struct | sequoia::maths::defines_half_line< T > |
Trait to determine if a type defines the half line. More... | |
Variables | |
template<class V , class ConvexSpace > | |
constexpr bool | sequoia::maths::validator_for_single_value |
Validators for spaces of dimension 1 must provide an operator() for validating single values. | |
template<class V , class ConvexSpace > | |
constexpr bool | sequoia::maths::validator_for_array |
Validators for spaces of dimension d>1 must provide an operator() for an array of d values. | |
Validators are central to dealing with spaces where the C++ representation could produce values outside the underlying set.
As an example, consider a half-line. Suppose the C++ representation involves floating-point values. Since these can be both positive and negative, runtime validation is required to ensure that invalid states of the half-line aren't constructed.
One natural approach is for validators to throw if they encounter a value out of range. However, this is by no means necessary. In some situations it may be more appropriate to clamp, particularly if the size of a violation is the order of magnitude of the expected (floating-point) precision.
For cases such as affine and vector spaces where validation is unnecessary (blithely ignoring the fact that NaN may be a representable floating-point value) std::identity holds a privileged position, indicating a transparent validator that performs no actual checking. However, its privileged status is determined by a trait, so that careful clients could implement their own to deal with edge cases such as NaN.
|
inlineconstexpr |
Validators for spaces of dimension d>1 must provide an operator() for an array of d values.
Let the type of the commutative ring associated with a space be space_value_type. Denote a d-dimensional std::array of such values by A. The validator must expose an operator() that consumes a single value of type A and its return type must be convertible to A.
|
inlineconstexpr |
Validators for spaces of dimension 1 must provide an operator() for validating single values.
Let the type of the commutative ring associated with a space be space_value_type. The validator must expose an operator() that consumes a single value of space_value_type, and its return type must be convertible to space_value_type.