Stan Math Library  2.20.0
reverse mode automatic differentiation
triangular_transpose.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_TRIANGULAR_TRANSPOSE_HPP
2 #define STAN_MATH_OPENCL_TRIANGULAR_TRANSPOSE_HPP
3 #ifdef STAN_OPENCL
4 
11 
12 #include <CL/cl.hpp>
13 
14 namespace stan {
15 namespace math {
16 
27 template <TriangularMapCL triangular_map>
29  if (size() == 0 || size() == 1) {
30  return;
31  }
32  check_size_match("triangular_transpose ((OpenCL))",
33  "Expecting a square matrix; rows of ", "A", rows(),
34  "columns of ", "A", cols());
35 
36  cl::CommandQueue cmdQueue = opencl_context.queue();
37  opencl_kernels::triangular_transpose(cl::NDRange(this->rows(), this->cols()),
38  *this, this->rows(), this->cols(),
39  triangular_map);
40 } catch (const cl::Error& e) {
41  check_opencl_error("triangular_transpose", e);
42 }
43 
44 } // namespace math
45 } // namespace stan
46 
47 #endif
48 #endif
const kernel_cl< in_out_buffer, int, int, TriangularMapCL > triangular_transpose("triangular_transpose", {indexing_helpers, triangular_transpose_kernel_code})
See the docs for triangular_transpose() .
The API to access the methods and values in opencl_context_base.
The matrix_cl class - allocates memory space on the OpenCL device, functions for transfering matrices...
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
void triangular_transpose()
Copies a lower/upper triangular of a matrix to it&#39;s upper/lower.
checking OpenCL error numbers
Initialization for OpenCL:
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:87
void check_opencl_error(const char *function, const cl::Error &e)
Throws the domain error with specifying the OpenCL error that occured.
cl::CommandQueue & queue()
Returns the reference to the active OpenCL command queue for the device.

     [ Stan Home Page ] © 2011–2018, Stan Development Team.