1#ifndef STAN_MATH_PRIM_FUN_ADD_DIAG_HPP
2#define STAN_MATH_PRIM_FUN_ADD_DIAG_HPP
25template <
typename T_m,
typename T_a,
typename = require_eigen_t<T_m>,
26 typename = require_any_t<is_eigen_vector<T_a>, is_stan_scalar<T_a>>>
27inline typename Eigen::Matrix<return_type_t<T_m, T_a>, Eigen::Dynamic,
31 const size_t length_diag = std::min(mat.rows(), mat.cols());
35 Eigen::Matrix<return_type_t<T_m, T_a>, Eigen::Dynamic, Eigen::Dynamic> out
37 out.diagonal().array()
auto as_column_vector_or_scalar(T &&a)
as_column_vector_or_scalar of a kernel generator expression.
T as_array_or_scalar(T &&v)
Returns specified input value.
void check_consistent_size(const char *function, const char *name, const T &x, size_t expected_size)
Check if x is consistent with size expected_size.
auto add_diag(T_m &&mat, T_a &&to_add)
Returns a Matrix with values added along the main diagonal.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
If the input type T is either an eigen matrix with 1 column or 1 row at compile time or a standard ve...