Stan Math Library  2.20.0
reverse mode automatic differentiation
transpose.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_OPENCL_TRANSPOSE_HPP
2 #define STAN_MATH_OPENCL_TRANSPOSE_HPP
3 #ifdef STAN_OPENCL
7 
8 #include <CL/cl.hpp>
9 
10 namespace stan {
11 namespace math {
20 inline matrix_cl transpose(const matrix_cl& src) {
21  matrix_cl dst(src.cols(), src.rows());
22  if (dst.size() == 0)
23  return dst;
24  try {
25  opencl_kernels::transpose(cl::NDRange(src.rows(), src.cols()), dst, src,
26  src.rows(), src.cols());
27  } catch (const cl::Error& e) {
28  check_opencl_error("transpose", e);
29  }
30  return dst;
31 }
32 } // namespace math
33 } // namespace stan
34 
35 #endif
36 #endif
const kernel_cl< out_buffer, in_buffer, int, int > transpose("transpose", {indexing_helpers, transpose_kernel_code})
See the docs for transpose() .
The matrix_cl class - allocates memory space on the OpenCL device, functions for transfering matrices...
Represents a matrix on the OpenCL device.
Definition: matrix_cl.hpp:29
checking OpenCL error numbers
matrix_cl transpose(const matrix_cl &src)
Takes the transpose of the matrix on the OpenCL device.
Definition: transpose.hpp:20
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.

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