Stan Math Library
4.9.0
Automatic Differentiation
|
void stan::math::check_unit_vector | ( | const char * | function, |
const char * | name, | ||
const Vec & | theta | ||
) |
Throw an exception if the specified vector does not have unit Euclidiean length.
A valid unit vector is one where the square of the elements summed 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.
Vec | A type derived from Eigen::EigenBase with either dynamic rows or columns but not both |
function | Function name (for error messages) |
name | Variable name (for error messages) |
theta | Vector to test |
`std::invalid_argument` | if theta is a 0-vector |
`std::domain_error` | if the vector is not a unit vector or if any element is NaN |
Definition at line 37 of file check_unit_vector.hpp.