Loading [MathJax]/extensions/TeX/AMSsymbols.js
Automatic Differentiation
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches

◆ as_array_or_scalar() [3/4]

template<typename T , typename = require_eigen_t<T>, require_not_eigen_array_t< T > * = nullptr>
auto stan::math::as_array_or_scalar ( T &&  v)
inline

Converts a matrix type to an array.

Converts an std::vector<std::vector> to an Eigen Array.

Converts a std::vector type to an array.

Template Parameters
TType of Eigen Matrix or expression
Parameters
vSpecified Eigen Matrix or expression.
Returns
Matrix converted to an array.
Note
The math library's reverse mode assumes that Eigen::Map types are allocated and owned elsewhere so we cannot just return back a map here else the reverse mode library may try to access into a dangling pointer. Instead we wrap the Eigen::Map in a Holder to trick the reverse mode library into not thinking this is a map. The .array().matrix() inside the holder is so that the holder thinks it is returning an expression.
Template Parameters
TType of scalar element.
Parameters
vSpecified vector.
Returns
Matrix converted to an array.
Template Parameters
TA standard vector with inner container of a standard vector with an inner stan scalar.
Parameters
vspecified vector of vectorized
Returns
An Eigen Array with dynamic rows and columns.

Definition at line 56 of file as_array_or_scalar.hpp.