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

◆ one_hot_row_vector()

Eigen::RowVectorXd stan::math::one_hot_row_vector ( int  K,
int  k 
)
inline

Return a row vector with 1 in the k-th position and zero elsewhere.

Parameters
Ksize of the row vector
kposition of the 1 (indexing from 1)
Returns
A row vector of size K with all elements initialized to zero and a 1 in the k-th position.
Exceptions
std::domain_errorif K is not positive, or if k is less than 1 or greater than K.

Definition at line 20 of file one_hot_row_vector.hpp.