Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ check_sum_to_zero()

template<typename T , require_matrix_t< T > * = nullptr>
void stan::math::check_sum_to_zero ( const char *  function,
const char *  name,
const T &  theta 
)

Throw an exception if the specified vector does not sum to 0.

Throw an exception if any vector in a standard vector does not sum to 0.

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
TA type inheriting from Eigen::EigenBase
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
thetaVector to test
Exceptions
`std::invalid_argument`if theta is a 0-vector
`std::domain_error`if the vector does not sum to zero

This function tests that the sum is within the tolerance specified by CONSTRAINT_TOLERANCE.

Template Parameters
TA standard vector with inner type inheriting from Eigen::EigenBase
Parameters
functionFunction name (for error messages)
nameVariable name (for error messages)
thetaVector to test.
Exceptions
`std::invalid_argument`if theta is a 0-vector
`std::domain_error`if the vector does not sum to zero

Definition at line 31 of file check_sum_to_zero.hpp.