|
Stratax
Scientific computing containers and operations
|
Functions | |
| template<typename Actual, typename Expected> | |
| void | require_type (const char *message) |
| Requires a type to exactly match an expected type after cv/ref removal. | |
| template<typename T> | |
| void | require_numeric_type (const char *message) |
| Requires a type to satisfy Stratax's numeric type rules. | |
| template<typename Lhs, typename Rhs> requires requires { typename Lhs::value_type; typename Rhs::value_type; } | |
| void | require_same_value_type (const Lhs &, const Rhs &, const char *message) |
| Requires two array-like objects to have the same value type. | |
| std::size_t | nonnegative_size (long long value, const char *message) |
| Converts a signed value to std::size_t after rejecting negatives. | |
| std::size_t | nonnegative_shape_dimension (long long value, const char *message) |
| Converts a signed shape dimension to std::size_t after rejecting negatives. | |
| std::size_t | positive_shape_dimension (long long value, const char *message) |
| Converts a signed shape dimension to std::size_t after requiring it to be positive. | |
| void | require_positive_shape_dimension (std::size_t value, const char *message) |
| Requires an unsigned shape dimension to be positive. | |
| std::size_t | nonnegative_index (long long value, const char *message) |
| Converts a signed index to std::size_t after rejecting negatives. | |
| void | require_rank (std::size_t actual, std::size_t expected, const char *message) |
| Requires a rank value to match an expected rank. | |
| template<typename Ranked> requires requires(const Ranked& object) { object.rank(); } | |
| const Ranked & | require_rank (const Ranked &object, std::size_t expected, const char *message) |
| Requires an object with rank() to match an expected rank. | |
| void | require_index (std::size_t index, std::size_t size, const char *message) |
| Requires an index to be less than a size. | |
| void | require_at_most (std::size_t value, std::size_t upper, const char *message) |
| Requires a value to be less than or equal to an upper bound. | |
| std::size_t | checked_multiply (std::size_t lhs, std::size_t rhs, const char *message) |
| Multiplies two sizes while checking for overflow. | |
| std::size_t | checked_add (std::size_t lhs, std::size_t rhs, const char *message) |
| Adds two sizes while checking for overflow. | |
| template<typename Lhs, typename Rhs> | |
| bool | same_shape (const Lhs &lhs, const Rhs &rhs) |
| Returns whether two array-like objects have identical size and shape. | |
| template<typename Lhs, typename Rhs> | |
| void | require_same_shape (const Lhs &lhs, const Rhs &rhs, const char *message) |
| Requires two array-like objects to have identical size and shape. | |
| void | require_equal_size (std::size_t lhs, std::size_t rhs, const char *message) |
| Requires two sizes to be equal. | |
|
inline |
Adds two sizes while checking for overflow.
| lhs | Left operand. |
| rhs | Right operand. |
| message | Error message used on overflow. |
| Exceptions::DimensionError | If the addition would overflow. |
Definition at line 278 of file Validation.hpp.
|
inline |
Multiplies two sizes while checking for overflow.
| lhs | Left operand. |
| rhs | Right operand. |
| message | Error message used on overflow. |
| Exceptions::DimensionError | If the multiplication would overflow. |
Definition at line 254 of file Validation.hpp.
Referenced by stratax::core::Shape::elements(), stratax::container::Matrix< U >::Matrix(), offset(), and slice().
|
inline |
Converts a signed index to std::size_t after rejecting negatives.
| value | Signed index to validate. |
| message | Error message used when value is negative. |
| Exceptions::IndexError | If value is negative. |
Definition at line 158 of file Validation.hpp.
|
inline |
Converts a signed shape dimension to std::size_t after rejecting negatives.
| value | Signed dimension to validate. |
| message | Error message used when value is negative. |
| Exceptions::ShapeError | If value is negative. |
Definition at line 102 of file Validation.hpp.
|
inline |
Converts a signed value to std::size_t after rejecting negatives.
| value | Signed value to validate. |
| message | Error message used when value is negative. |
| Exceptions::DimensionError | If value is negative. |
Definition at line 82 of file Validation.hpp.
|
inline |
Converts a signed shape dimension to std::size_t after requiring it to be positive.
| value | Signed dimension to validate. |
| message | Error message used when value <= 0. |
| Exceptions::ShapeError | If value <= 0. |
Definition at line 122 of file Validation.hpp.
|
inline |
Requires a value to be less than or equal to an upper bound.
This is useful for half-open range stops, where stop == size is valid.
| value | Value to validate. |
| upper | Inclusive upper bound. |
| message | Error message used when value > upper. |
| Exceptions::IndexError | If value > upper. |
Definition at line 235 of file Validation.hpp.
|
inline |
Requires two sizes to be equal.
| lhs | Left size. |
| rhs | Right size. |
| message | Error message used on mismatch. |
| Exceptions::ShapeError | If the sizes differ. |
Definition at line 332 of file Validation.hpp.
Referenced by reshape().
|
inline |
Requires an index to be less than a size.
| index | Index to validate. |
| size | Exclusive upper bound. |
| message | Error message used when out of bounds. |
| Exceptions::IndexError | If index >= size. |
Definition at line 216 of file Validation.hpp.
Referenced by stratax::container::Tensor< U >::at(), stratax::container::Tensor< U >::at(), stratax::container::Vector< U >::at(), stratax::container::Vector< U >::at(), stratax::core::Strides::at(), stratax::container::Matrix< U >::operator()(), stratax::container::Matrix< U >::operator()(), and stratax::core::Shape::operator()().
| void stratax::core::validation::require_numeric_type | ( | const char * | message | ) |
Requires a type to satisfy Stratax's numeric type rules.
| T | Type being validated. |
| message | Error message used when the type is unsupported. |
| Exceptions::TypeError | If T is not a supported numeric type. |
Definition at line 44 of file Validation.hpp.
|
inline |
Requires an unsigned shape dimension to be positive.
| value | Dimension to validate. |
| message | Error message used when value == 0. |
| Exceptions::ShapeError | If value == 0. |
Definition at line 140 of file Validation.hpp.
| const Ranked & stratax::core::validation::require_rank | ( | const Ranked & | object, |
| std::size_t | expected, | ||
| const char * | message ) |
Requires an object with rank() to match an expected rank.
| object | Object to validate. |
| expected | Required rank. |
| message | Error message used on mismatch. |
| Exceptions::DimensionError | If the object rank differs. |
Definition at line 201 of file Validation.hpp.
References require_rank().
|
inline |
Requires a rank value to match an expected rank.
| actual | Actual rank. |
| expected | Required rank. |
| message | Error message used on mismatch. |
| Exceptions::DimensionError | If the ranks differ. |
Definition at line 177 of file Validation.hpp.
Referenced by offset(), require_rank(), slice(), to_matrix(), and to_vector().
| void stratax::core::validation::require_same_shape | ( | const Lhs & | lhs, |
| const Rhs & | rhs, | ||
| const char * | message ) |
Requires two array-like objects to have identical size and shape.
| lhs | Left object. |
| rhs | Right object. |
| message | Error message used on mismatch. |
| Exceptions::ShapeError | If size or shape differ. |
Definition at line 315 of file Validation.hpp.
References same_shape().
Referenced by require_same_arithmetic_shape().
| void stratax::core::validation::require_same_value_type | ( | const Lhs & | , |
| const Rhs & | , | ||
| const char * | message ) |
Requires two array-like objects to have the same value type.
| lhs | Left object. |
| rhs | Right object. |
| message | Error message used on mismatch. |
| Exceptions::TypeError | If the objects' normalized value_types differ. |
Definition at line 67 of file Validation.hpp.
References require_type().
| void stratax::core::validation::require_type | ( | const char * | message | ) |
Requires a type to exactly match an expected type after cv/ref removal.
| Actual | Type being validated. |
| Expected | Required type. |
| message | Error message used on mismatch. |
| Exceptions::TypeError | If the normalized types differ. |
Definition at line 27 of file Validation.hpp.
Referenced by require_same_value_type().
|
nodiscard |
Returns whether two array-like objects have identical size and shape.
| lhs | Left object. |
| rhs | Right object. |
Definition at line 300 of file Validation.hpp.
Referenced by operator==(), and require_same_shape().