Automatic Differentiation
 
Loading...
Searching...
No Matches
is_vector.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_IS_VECTOR_HPP
2#define STAN_MATH_PRIM_META_IS_VECTOR_HPP
3
10#include <type_traits>
11#include <vector>
12
13namespace stan {
14
18template <typename T, typename = void>
19struct is_std_vector : std::false_type {};
20
21namespace internal {
26template <typename T, bool = is_eigen<T>::value>
28 : bool_constant<std::decay_t<T>::ColsAtCompileTime == 1> {};
29
33template <typename T>
34struct is_eigen_col_vector_impl<T, false> : std::false_type {};
35
39template <typename T, bool = is_eigen<T>::value>
41 : std::integral_constant<bool, std::decay_t<T>::RowsAtCompileTime == 1> {};
42
46template <typename T>
47struct is_eigen_row_vector_impl<T, false> : std::false_type {};
48
52template <typename T, bool = bool_constant<is_eigen<T>::value
53 || (is_eigen<value_type_t<T>>::value
54 && is_var<T>::value)>::value>
56 : bool_constant<std::decay_t<T>::ColsAtCompileTime == 1> {};
57
61template <typename T>
62struct is_col_vector_impl<T, false> : std::false_type {};
63
67template <typename T, bool = bool_constant<is_eigen<T>::value
68 || (is_eigen<value_type_t<T>>::value
69 && is_var<T>::value)>::value>
71 : std::integral_constant<bool, std::decay_t<T>::RowsAtCompileTime == 1> {};
72
76template <typename T>
77struct is_row_vector_impl<T, false> : std::false_type {};
78
79} // namespace internal
80
86template <typename T>
88
96template <typename T>
99
102template <typename T>
105
108template <typename... Types>
123template <template <class...> class TypeCheck, class... Check>
126 TypeCheck, Check...>>;
135template <typename T>
137
145template <typename T>
147
150template <typename T>
152
155template <typename... Types>
165template <typename T>
167
175template <typename T>
186template <typename T>
188
196template <typename T>
205template <typename T>
206struct is_eigen_vector : bool_constant<is_eigen_col_vector<T>::value
207 || is_eigen_row_vector<T>::value> {};
208
216template <typename T>
218
221template <typename T>
224
227template <typename... Types>
230
233template <typename... Types>
236
239template <typename... Types>
242
246template <typename... Types>
261template <template <class...> class TypeCheck, class... Check>
264 TypeCheck, Check...>>;
265
271template <template <class...> class TypeCheck, class... Check>
274 TypeCheck, Check...>>;
275
281template <template <class...> class TypeCheck, class... Check>
284 TypeCheck, Check>...>;
285
292template <template <class...> class TypeCheck, class... Check>
295 TypeCheck, Check>...>;
296
302template <template <class...> class TypeCheck, class... Check>
305 TypeCheck, Check>...>;
306
312template <template <class...> class TypeCheck, class... Check>
315 TypeCheck, Check>...>;
316
322template <template <class...> class TypeCheck, class... Check>
325 TypeCheck, Check...>>;
326
332template <template <class...> class TypeCheck, class... Check>
335 TypeCheck, Check...>>;
336
342template <template <class...> class TypeCheck, class... Check>
345 TypeCheck, Check>...>;
346
353template <template <class...> class TypeCheck, class... Check>
356 is_eigen_vector, scalar_type_t, TypeCheck, Check>...>;
357
363template <template <class...> class TypeCheck, class... Check>
366 TypeCheck, Check>...>;
367
373template <template <class...> class TypeCheck, class... Check>
376 is_eigen_vector, scalar_type_t, TypeCheck, Check>...>;
383template <typename Row, typename Col>
386
391template <typename Row, typename Col>
394
399template <typename Row, typename Col>
402
407template <typename Row, typename Col>
410
417template <typename T>
419 : bool_constant<is_eigen_vector<T>::value || is_std_vector<T>::value
420 || (is_var<T>::value
421 && is_eigen_vector<value_type_t<T>>::value)> {};
422
430template <typename T>
432
435template <typename T>
437
440template <typename... Types>
442
445template <typename... Types>
447
450template <typename... Types>
453
456template <typename... Types>
471template <template <class...> class TypeCheck, class... Check>
473 container_type_check_base<is_vector, value_type_t, TypeCheck, Check...>>;
474
480template <template <class...> class TypeCheck, class... Check>
482 container_type_check_base<is_vector, value_type_t, TypeCheck, Check...>>;
483
489template <template <class...> class TypeCheck, class... Check>
492
498template <template <class...> class TypeCheck, class... Check>
501
507template <template <class...> class TypeCheck, class... Check>
510
516template <template <class...> class TypeCheck, class... Check>
519
525template <template <class...> class TypeCheck, class... Check>
527 container_type_check_base<is_vector, scalar_type_t, TypeCheck, Check...>>;
528
534template <template <class...> class TypeCheck, class... Check>
536 container_type_check_base<is_vector, scalar_type_t, TypeCheck, Check...>>;
537
543template <template <class...> class TypeCheck, class... Check>
546
552template <template <class...> class TypeCheck, class... Check>
555
561template <template <class...> class TypeCheck, class... Check>
564
570template <template <class...> class TypeCheck, class... Check>
575namespace internal {
576
580template <typename T>
581struct is_std_vector_impl : std::false_type {};
582
587template <typename... Args>
588struct is_std_vector_impl<std::vector<Args...>> : std::true_type {};
589
590} // namespace internal
591
595template <typename T>
597 T, std::enable_if_t<internal::is_std_vector_impl<std::decay_t<T>>::value>>
598 : std::true_type {};
599
606template <typename T>
607struct scalar_type<T, std::enable_if_t<is_std_vector<T>::value>> {
609};
610
617template <typename T>
618struct value_type<T, std::enable_if_t<is_std_vector<T>::value>> {
619 using type = typename std::decay_t<T>::value_type;
620};
621
629template <typename T>
631
634template <typename T>
636
639template <typename... Types>
642
645template <typename... Types>
648
651template <typename... Types>
654
658template <typename... Types>
673template <template <class...> class TypeCheck, class... Check>
676 TypeCheck, Check...>>;
677
683template <template <class...> class TypeCheck, class... Check>
686 TypeCheck, Check...>>;
687
693template <template <class...> class TypeCheck, class... Check>
696 TypeCheck, Check>...>;
697
704template <template <class...> class TypeCheck, class... Check>
707 TypeCheck, Check>...>;
708
714template <template <class...> class TypeCheck, class... Check>
717 TypeCheck, Check>...>;
718
724template <template <class...> class TypeCheck, class... Check>
727 TypeCheck, Check>...>;
728
734template <template <class...> class TypeCheck, class... Check>
737 TypeCheck, Check...>>;
738
744template <template <class...> class TypeCheck, class... Check>
747 TypeCheck, Check...>>;
748
754template <template <class...> class TypeCheck, class... Check>
757 TypeCheck, Check>...>;
758
765template <template <class...> class TypeCheck, class... Check>
768 TypeCheck, Check>...>;
769
775template <template <class...> class TypeCheck, class... Check>
778 TypeCheck, Check>...>;
779
785template <template <class...> class TypeCheck, class... Check>
788 TypeCheck, Check>...>;
791} // namespace stan
792#endif
require_t< is_col_vector< std::decay_t< T > > > require_col_vector_t
Require type satisfies is_col_vector.
require_not_t< is_col_vector< std::decay_t< T > > > require_not_col_vector_t
Require type does not satisfy is_col_vector.
require_all_t< is_col_vector< std::decay_t< Types > >... > require_all_col_vector_t
Require all of the types satisfy is_col_vector.
require_t< container_type_check_base< is_eigen_col_vector, value_type_t, TypeCheck, Check... > > require_eigen_col_vector_vt
Require type satisfies is_eigen_col_vector.
require_t< is_eigen_col_vector< std::decay_t< T > > > require_eigen_col_vector_t
Require type satisfies is_eigen_col_vector.
Definition is_vector.hpp:98
require_not_t< is_eigen_col_vector< std::decay_t< T > > > require_not_eigen_col_vector_t
Require type does not satisfy is_eigen_col_vector.
require_all_t< is_eigen_col_vector< std::decay_t< Types > >... > require_all_eigen_col_vector_t
Require all of the types satisfy is_eigen_col_vector.
require_t< is_eigen_row_vector< std::decay_t< T > > > require_eigen_row_vector_t
Require type satisfies is_eigen_row_vector.
require_any_not_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check >... > require_any_not_eigen_vector_vt
Require at least one of the types does not satisfy is_eigen_vector.
require_all_not_t< is_eigen_vector< std::decay_t< Types > >... > require_all_not_eigen_vector_t
Require none of the types satisfy is_eigen_vector.
require_all_not_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check >... > require_all_not_eigen_vector_vt
Require none of the types satisfy is_eigen_vector.
require_not_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check... > > require_not_eigen_vector_vt
Require type does not satisfy is_eigen_vector or.
require_not_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check... > > require_not_eigen_vector_st
Require type does not satisfy is_eigen_vector.
require_any_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check >... > require_any_eigen_vector_vt
Require any of the types satisfy is_eigen_vector.
require_all_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check >... > require_all_eigen_vector_vt
Require all of the types satisfy is_eigen_vector.
require_t< is_eigen_vector< std::decay_t< T > > > require_eigen_vector_t
Require type satisfies is_eigen_vector.
require_t< container_type_check_base< is_eigen_vector, value_type_t, TypeCheck, Check... > > require_eigen_vector_vt
Require type satisfies is_eigen_vector.
require_any_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check >... > require_any_eigen_vector_st
Require any of the types satisfy is_eigen_vector.
require_not_t< is_eigen_vector< std::decay_t< T > > > require_not_eigen_vector_t
Require type does not satisfy is_eigen_vector.
require_all_not_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check >... > require_all_not_eigen_vector_st
Require none of the types satisfy is_eigen_vector.
require_any_not_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check >... > require_any_not_eigen_vector_st
Require at least one of the types does not satisfy is_eigen_vector.
require_any_t< is_eigen_vector< std::decay_t< Types > >... > require_any_eigen_vector_t
Require any of the types satisfy is_eigen_vector.
require_any_not_t< is_eigen_vector< std::decay_t< Types > >... > require_any_not_eigen_vector_t
Require at least one of the types do not satisfy is_eigen_vector.
require_all_t< is_eigen_vector< std::decay_t< Types > >... > require_all_eigen_vector_t
Require all of the types satisfy is_eigen_vector.
require_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check... > > require_eigen_vector_st
Require type satisfies is_eigen_vector.
require_all_t< container_type_check_base< is_eigen_vector, scalar_type_t, TypeCheck, Check >... > require_all_eigen_vector_st
Require all of the types does not satisfy is_eigen_vector.
require_t< is_row_vector< std::decay_t< T > > > require_row_vector_t
Require type satisfies is_row_vector.
require_any_not_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_any_not_std_vector_vt
Require at least one of the types does not satisfy is_std_vector.
require_not_t< is_std_vector< std::decay_t< T > > > require_not_std_vector_t
Require type does not satisfy is_std_vector.
require_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check... > > require_std_vector_vt
Require type satisfies is_std_vector.
require_all_not_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check >... > require_all_not_std_vector_st
Require none of the types satisfy is_std_vector.
require_any_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_any_std_vector_vt
Require any of the types satisfy is_std_vector.
require_not_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check... > > require_not_std_vector_vt
Require type does not satisfy is_std_vector or.
require_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check... > > require_std_vector_st
Require type satisfies is_std_vector.
require_any_t< is_std_vector< std::decay_t< Types > >... > require_any_std_vector_t
Require any of the types satisfy is_std_vector.
require_all_not_t< is_std_vector< std::decay_t< Types > >... > require_all_not_std_vector_t
Require none of the types satisfy is_std_vector.
require_t< is_std_vector< std::decay_t< T > > > require_std_vector_t
Require type satisfies is_std_vector.
require_any_not_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check >... > require_any_not_std_vector_st
Require at least one of the types does not satisfy is_std_vector.
require_not_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check... > > require_not_std_vector_st
Require type does not satisfy is_std_vector.
require_all_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_all_std_vector_vt
Require all of the types satisfy is_std_vector.
require_all_t< is_std_vector< std::decay_t< Types > >... > require_all_std_vector_t
Require all of the types satisfy is_std_vector.
require_all_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check >... > require_all_std_vector_st
Require all of the types does not satisfy is_std_vector.
require_any_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check >... > require_any_std_vector_st
Require any of the types satisfy is_std_vector.
require_all_not_t< container_type_check_base< is_std_vector, value_type_t, TypeCheck, Check >... > require_all_not_std_vector_vt
Require none of the types satisfy is_std_vector.
require_any_not_t< is_std_vector< std::decay_t< Types > >... > require_any_not_std_vector_t
Require at least one of the types do not satisfy is_std_vector.
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
require_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check... > > require_vector_vt
Require type satisfies is_vector.
require_not_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check... > > require_not_vector_st
Require type does not satisfy is_vector.
require_all_t< is_vector< std::decay_t< Types > >... > require_all_vector_t
Require all of the types satisfy is_vector.
require_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check... > > require_vector_st
Require type satisfies is_vector.
require_t< is_vector< std::decay_t< T > > > require_vector_t
Require type satisfies is_vector.
require_all_not_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check >... > require_all_not_vector_st
Require none of the types satisfy is_vector.
require_any_not_t< is_vector< std::decay_t< Types > >... > require_any_not_vector_t
Require at least one of the types do not satisfy is_vector.
require_all_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check >... > require_all_vector_vt
Require all of the types satisfy is_vector.
require_any_not_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check >... > require_any_not_vector_vt
Require at least one of the types does not satisfy is_vector.
require_not_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check... > > require_not_vector_vt
Require type does not satisfy is_vector or.
require_all_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check >... > require_all_vector_st
Require all of the types does not satisfy is_vector.
require_any_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check >... > require_any_vector_st
Require any of the types satisfy is_vector.
require_any_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check >... > require_any_vector_vt
Require any of the types satisfy is_vector.
require_all_not_t< is_vector< std::decay_t< Types > >... > require_all_not_vector_t
Require none of the types satisfy is_vector.
require_not_t< is_vector< std::decay_t< T > > > require_not_vector_t
Require type does not satisfy is_vector.
require_any_not_t< container_type_check_base< is_vector, scalar_type_t, TypeCheck, Check >... > require_any_not_vector_st
Require at least one of the types does not satisfy is_vector.
require_any_t< is_vector< std::decay_t< Types > >... > require_any_vector_t
Require any of the types satisfy is_vector.
require_all_not_t< container_type_check_base< is_vector, value_type_t, TypeCheck, Check >... > require_all_not_vector_vt
Require none of the types satisfy is_vector.
std::enable_if_t<!Check::value > require_not_t
If condition is false, template is disabled.
std::enable_if_t< math::disjunction< Checks... >::value > require_any_t
If any condition is true, template is enabled.
require_not_t< math::conjunction< is_eigen_row_vector< Row >, is_eigen_col_vector< Col > > > require_not_eigen_row_and_col_t
Require Row is not a row vector and Col is not a column vector.
require_not_t< math::conjunction< is_row_vector< Row >, is_col_vector< Col > > > require_not_row_and_col_vector_t
Require Row is not a row vector and Col is not a column vector.
require_t< math::conjunction< is_eigen_row_vector< Row >, is_eigen_col_vector< Col > > > require_eigen_row_and_col_t
Require Row is a row vector and Col is a column vector.
std::enable_if_t<!math::disjunction< Checks... >::value > require_all_not_t
If all conditions are false, template is enabled.
bool_constant< math::conjunction< ContainerCheck< std::decay_t< Check > >..., TypeCheck< ValueCheck< Check > >... >::value > container_type_check_base
Used as the base for checking whether a type is a container with an underlying scalar type.
typename scalar_type< T >::type scalar_type_t
std::enable_if_t<!math::conjunction< Checks... >::value > require_any_not_t
If any condition is false, template is enabled.
std::enable_if_t< Check::value > require_t
If condition is true, template is enabled.
std::enable_if_t< math::conjunction< Checks... >::value > require_all_t
If all conditions are true, template is enabled Returns a type void if all conditions are true and ot...
require_t< math::conjunction< is_row_vector< Row >, is_col_vector< Col > > > require_row_and_col_vector_t
Require Row is a row vector and Col is a column vector.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
STL namespace.
Underlying implementation for detecting if a Matrix is a column vector.
Definition is_vector.hpp:56
Underlying implementation for detecting if an Eigen Matrix is a column vector.
Definition is_vector.hpp:28
Underlying implementation for detecting if an Eigen Matrix is a row vector.
Definition is_vector.hpp:41
Underlying implementation for detecting if a Matrix is a row vector.
Definition is_vector.hpp:71
This underlying implementation is used when the type is not an std vector.
If the input type T has a static comple time constant type ColsAtCompileTime equal to 1 this has a st...
If the input type T is an eigen matrix with 1 row at compile time this has a static member with a val...
Definition is_vector.hpp:87
If the input type T is an eigen matrix with 1 column at compile time this has a static member with a ...
If the input type T is an eigen matrix with 1 column or 1 row at compile time this has a static membe...
Check if type derives from EigenBase
Definition is_eigen.hpp:21
If the input type T has a static comple time constant type RowsAtCompileTime equal to 1 this has a st...
Base implementation for checking if type is std vector.
Definition is_vector.hpp:19
Defines a static member named value which is defined to be false as the primitive scalar types cannot...
Definition is_var.hpp:14
If the input type T is either an eigen matrix with 1 column or 1 row at compile time or a standard ve...
Extends std::true_type when instantiated with zero or more template parameters, all of which extend t...
scalar_type_t< typename std::decay_t< T >::value_type > type
Metaprogram structure to determine the base scalar type of a template argument.
Primary template class for metaprogram to compute the type of values stored in a container.