Automatic Differentiation
 
Loading...
Searching...
No Matches
trace.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_TRACE_HPP
2#define STAN_MATH_OPENCL_PRIM_TRACE_HPP
3#ifdef STAN_OPENCL
4
10
11namespace stan {
12namespace math {
13
20template <typename T,
21 require_all_kernel_expressions_and_none_scalar_t<T>* = nullptr>
23 return sum(diagonal(m));
24}
25
26} // namespace math
27} // namespace stan
28
29#endif
30#endif
auto diagonal(T &&a)
Diagonal of a kernel generator expression.
Definition diagonal.hpp:136
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
value_type_t< T > trace(const T &m)
Calculates trace (sum of diagonal) of given kernel generator expression.
Definition trace.hpp:22
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
Definition sum.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...