Throw an exception if the specified matrix is not a row stochastic matrix.
Throw an exception if the specified matrices in a standard vector are not a row stochastic matrix.
To be a row stochastic matrix, all the values in each row must be greater than or equal to 0 and the values must sum to 1. A valid row stochastic matrix is one where the sum of the elements by row is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE
. This function only accepts Eigen matrices, 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 | Matrix to test |
- Exceptions
-
`std::invalid_argument` | if theta is a 0-vector |
`std::domain_error` | if the vector is not a row stochastic matrix or if any element is NaN |
To be a row stochastic matrix, all the values in each row must be greater than or equal to 0 and the values must sum to 1. A valid row stochastic matrix is one where the sum of the elements by row is equal to 1. This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE
. This function only accepts Eigen matrices, 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 | Matrix to test |
- Exceptions
-
`std::invalid_argument` | if theta is a 0-vector |
`std::domain_error` | if the standard vector's matrices are not row stochastic matrix or if any element is NaN |
Definition at line 35 of file check_stochastic_row.hpp.