Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untangles all of our includes! #254

Merged
merged 30 commits into from
Mar 16, 2016
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
29c62a4
Updating makefile help
syclik Mar 3, 2016
17ea996
Updating comment in fwd/mat/functor/gradient.hpp
syclik Mar 3, 2016
a2f475d
Removing prim/arr header from prim/scal
syclik Mar 3, 2016
a3fb372
Fixing prim/scal/meta/scalar_type.hpp includes and adding mat test
syclik Mar 3, 2016
2563d58
Updating tests
syclik Mar 4, 2016
a846164
Updating includes
syclik Mar 4, 2016
cb731ec
Adding more to VectorBuilder and VectorBuilderHelper; added tests
syclik Mar 4, 2016
e86e3c8
Untangling more includes
syclik Mar 4, 2016
688acac
Cleaning up includes for neg_binomial_2_cdf functions
syclik Mar 4, 2016
d04dab1
Fixing includes on coupled_ode_system
syclik Mar 5, 2016
bb5b685
Splitting apart prim/mat/err/check_ordered_test.cpp
syclik Mar 5, 2016
ddccb14
Updating integrate_ode
syclik Mar 5, 2016
7dfd17e
Splitting apart OperandsAndPartials_test
syclik Mar 5, 2016
7a3af35
Moving VectorViewMvt to prim/mat/meta
syclik Mar 7, 2016
5ab6556
Reimplementing VectorView
syclik Mar 8, 2016
270c08a
Fixing more test includes
syclik Mar 9, 2016
02d7a88
Splitting apart OperandsAndPartials
syclik Mar 10, 2016
55e70b0
Including header for is_constant_struct
syclik Mar 10, 2016
25240a1
Fixing check_nonzero_size
syclik Mar 11, 2016
5653b99
Fixing doxygen
syclik Mar 11, 2016
7a7e69d
Fixing more includes
syclik Mar 11, 2016
a0b4cea
Cpplint
syclik Mar 11, 2016
1131b6c
Included stdexcept
syclik Mar 11, 2016
52b1b6d
Squashing a compiler warning in a test
syclik Mar 11, 2016
57ab0ed
Fixed one last OperandsAndPartials thing
syclik Mar 11, 2016
55690fc
Fixing use of VectorBuilder
syclik Mar 12, 2016
9ca5021
Fixing neg_binonial_2
syclik Mar 12, 2016
d3f05ae
cpplint
syclik Mar 13, 2016
ddc580d
Moving check_nonzero_size to arr and fixing behavior to act like it d…
syclik Mar 14, 2016
7e49dc2
added to VectorView doc
Mar 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added to VectorView doc
  • Loading branch information
Bob Carpenter committed Mar 16, 2016
commit 7e49dc2d04fb9c03dbccd26464783ce1e60cd5c0
49 changes: 28 additions & 21 deletions stan/math/prim/scal/meta/VectorView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,38 @@
namespace stan {

/**
* VectorView is a template metaprogram that takes its argument and
* allows it to be used like a vector. There are three template parameters
* - T: Type of the thing to be wrapped. For example,
* double, var, vector<double>, etc.
* - is_array: Boolean variable indicating whether the underlying type is
* an array.
* - throw_if_accessed: Boolean variable indicating whether this instance
* should not be used and should throw if operator[] is used.
* VectorView is a template expression that is constructed with a
* container or scalar, which it then allows to be used as an array
* using <code>operator[]</code>.
*
* For a scalar value, it broadcasts the single value when using
* operator[].
* For a scalar value, any index returns the reference or pointer
* used to construct the view.
*
* 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.
* For a container, the index returns a reference to the position in
* the underlying container used to construct the view. WARNING:
* There is no bounds checking for container indices and they will
* segfault if accessed beyond their boundaries.
*
* 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)
* The first use is to 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)
* The second use is to build up derivatives into common storage :
* VectorView of mutable shared array (no allocation because
* allocated on auto-diff arena memory).
*
* Because it deals with references to its inputs, it is up to the
* client of VectorView to ensure that the container being wrapped
* is not modified while the VectorView is in use in such a way as
* to disrupt the indexing. Similarly, because it deals with
* references, it cannot be constructed with a literal or expression.
*
* @tparam T Type of scalar or container being wrapped.
* @tparam is_array True if underlying type T can be indexed with
* operator[].
* @tparam throw_if_accessed True if the behaviro is to throw an
* exception whenever <code>operator[]</code> is called.
*/
template <typename T,
bool is_array = stan::is_vector_like<T>::value,
Expand Down