![]() |
Stan Math Library
2.6.3
probability, sampling & optimization
|
VectorView is a template metaprogram that takes its argument and allows it to be used like a vector. More...
#include <VectorView.hpp>
Public Types | |
typedef scalar_type< T >::type | scalar_t |
Public Member Functions | |
VectorView (scalar_t &c) | |
VectorView (std::vector< scalar_t > &v) | |
template<int R, int C> | |
VectorView (Eigen::Matrix< scalar_t, R, C > &m) | |
VectorView (scalar_t *x) | |
scalar_t & | operator[] (int i) |
VectorView is a template metaprogram that takes its argument and allows it to be used like a vector.
There are three template parameters
For a scalar value, it broadcasts the single value when using operator[].
For a vector, operator[] looks into the value passed in. Note: this is not safe. It is possible to read past the size of an array.
Uses: Read arguments to prob functions as vectors, even if scalars, so they can be read by common code (and scalars automatically broadcast up to behave like vectors) : VectorView of immutable const array of double* (no allocation)
Build up derivatives into common storage : VectorView of mutable shared array (no allocation because allocated on auto-diff arena memory)
Definition at line 41 of file VectorView.hpp.
typedef scalar_type<T>::type stan::VectorView< T, is_array, throw_if_accessed >::scalar_t |
Definition at line 43 of file VectorView.hpp.
|
inlineexplicit |
Definition at line 45 of file VectorView.hpp.
|
inlineexplicit |
Definition at line 47 of file VectorView.hpp.
|
inlineexplicit |
Definition at line 50 of file VectorView.hpp.
|
inlineexplicit |
Definition at line 52 of file VectorView.hpp.
|
inline |
Definition at line 54 of file VectorView.hpp.