Throw an exception if the specified vector is not a simplex.
Throw an exception if each vector in a standard vector is not a simplex.
To be a simplex, all values must be greater than or equal to 0 and the values must sum to 1. A valid simplex is one where the sum of the elements is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE
. This function only accepts Eigen vectors, statically typed vectors, not general matrices with 1 column.
- Template Parameters
-
T | A type inheriting from Eigen::EigenBase |
- Parameters
-
function | Function name (for error messages) |
name | Variable name (for error messages) |
theta | Vector to test |
- Exceptions
-
`std::invalid_argument` | if theta is a 0-vector |
`std::domain_error` | if the vector is not a simplex or if any element is NaN |
To be a simplex, all values must be greater than or equal to 0 and the values must sum to 1. A valid simplex is one where the sum of the elements is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE
. This function only accepts Eigen vectors, statically typed vectors, not general matrices with 1 column.
- Template Parameters
-
T | A standard vector with inner type inheriting from Eigen::EigenBase |
- Parameters
-
function | Function name (for error messages) |
name | Variable name (for error messages) |
theta | Vector to test. |
- Exceptions
-
`std::invalid_argument` | if theta is a 0-vector |
`std::domain_error` | if the vector is not a simplex or if any element is NaN |
Definition at line 34 of file check_simplex.hpp.