Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ packed_copy() [2/2]

template<matrix_cl_view matrix_view, typename Vec , typename Vec_scalar = scalar_type_t<Vec>, require_vector_vt< std::is_arithmetic, Vec > * = nullptr>
matrix_cl< Vec_scalar > stan::math::packed_copy ( Vec &&  src,
int  rows 
)
inline

Copies the packed triangular matrix from the source std::vector to an OpenCL buffer and unpacks it to a flat matrix on the OpenCL device.

If a lvalue is passed to this constructor the caller must make sure that it does not go out of scope before copying is complete.

That means .wait() must be called on the event associated on copying or any other event that requires completion of this event. This can be done by calling .wait_for_write_events() or .wait_for_read_write_events() on returned matrix or any matrix that is calculated from that one.

Template Parameters
matrix_viewthe triangularity of the source matrix
Parameters
srcthe packed source std::vector
rowsthe number of rows in the flat matrix
Returns
the destination flat matrix on the OpenCL device
Exceptions
<code>std::invalid_argument</code>if the size of the vector does not match the expected size for the packed triangular matrix

Definition at line 302 of file copy.hpp.