Automatic Differentiation
 
Loading...
Searching...
No Matches
identity_matrix.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_IDENTITY_MATRIX_HPP
2#define STAN_MATH_PRIM_FUN_IDENTITY_MATRIX_HPP
3
7
8namespace stan {
9namespace math {
10
18template <typename T = Eigen::MatrixXd, require_eigen_t<T>* = nullptr>
19inline auto identity_matrix(int K) {
20 check_nonnegative("identity_matrix", "size", K);
21 return T::Identity(K, K);
22}
23
24} // namespace math
25} // namespace stan
26
27#endif
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
auto identity_matrix(int K)
Return a square identity matrix.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9