Automatic Differentiation
 
Loading...
Searching...
No Matches
multiply_lower_tri_self_transpose.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
2#define STAN_MATH_OPENCL_PRIM_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
3#ifdef STAN_OPENCL
4
7
8namespace stan {
9namespace math {
10
19template <typename T_x,
20 require_all_kernel_expressions_and_none_scalar_t<T_x>* = nullptr>
22 matrix_cl<double> x_eval = std::forward<T_x>(x);
23 if (x_eval.size() == 0) {
24 return matrix_cl<double>(0, 0);
25 }
26 matrix_cl<double> x_lower(x_eval.buffer(), x_eval.rows(), x_eval.cols(),
28 for (auto e : x_eval.write_events()) {
29 x_lower.add_write_event(e);
30 }
31 matrix_cl<double> res = x_lower * transpose(x_lower);
32 x_eval.add_read_event(x_lower.read_events().back());
33 return res;
34}
35} // namespace math
36} // namespace stan
37#endif
38#endif
const cl::Buffer & buffer() const
void add_read_event(cl::Event new_event) const
Add an event to the read event stack.
const tbb::concurrent_vector< cl::Event > & read_events() const
Get the events from the event stacks.
void add_write_event(cl::Event new_event) const
Add an event to the write event stack.
const tbb::concurrent_vector< cl::Event > & write_events() const
Get the events from the event stacks.
Represents an arithmetic matrix on the OpenCL device.
Definition matrix_cl.hpp:47
auto transpose(Arg &&a)
Transposes a kernel generator expression.
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::RowsAtCompileTime > multiply_lower_tri_self_transpose(const EigMat &m)
static constexpr double e()
Return the base of the natural logarithm.
Definition constants.hpp:20
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9