1#ifndef STAN_MATH_REV_FUN_ROWS_DOT_SELF_HPP
2#define STAN_MATH_REV_FUN_ROWS_DOT_SELF_HPP
20template <
typename Mat, require_eigen_vt<is_var, Mat>* =
nullptr>
23 Eigen::Matrix<var, Mat::RowsAtCompileTime, 1> ret(x.rows());
24 for (
size_type i = 0; i < x.rows(); i++) {
36template <
typename Mat, require_var_matrix_t<Mat>* =
nullptr>
42 x.adj() += (2 * res.adj()).asDiagonal() * x.val();
auto rows_dot_self(T_a &&a)
Returns the dot product of each row of a matrix with itself.
void reverse_pass_callback(F &&functor)
Puts a callback on the autodiff stack to be called in reverse pass.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double elements.
auto dot_self(const T &a)
Returns squared norm of a vector or matrix.
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...