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

Expanding 5 macros STAN_ADD_REQUIRE_* directly into code. #2965

Merged
merged 152 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
09500b5
replacing two macro calls
syclik Oct 20, 2023
18ad3b4
expanding STAN_ADD_REQUIRE_UNARY(...) macro
syclik Oct 20, 2023
1684854
expanding STAN_ADD_REQUIRE_UNARY_INNER(...) macro
syclik Oct 22, 2023
01488a8
expanding STAN_ADD_REQUIRE_BINARY_INNER(...) macro
syclik Oct 22, 2023
56e960e
expanding STAN_ADD_REQUIRE_CONTAINER(...) macro
syclik Oct 22, 2023
1a41603
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Oct 22, 2023
8295f0b
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Oct 22, 2023
940c3b5
fixing a few mistakes in expansion
syclik Oct 23, 2023
5571c5d
removing duplicated macro expansion
syclik Oct 23, 2023
2d032a0
removing unused require_ from stan/math/prim/meta/is_arena_matrix.hpp
syclik Oct 23, 2023
71c5b70
removing unused require_ from stan/math/prim/meta/is_autodiff.hpp
syclik Oct 23, 2023
478f4cb
removing unused require_ from stan/math/prim/meta/is_complex.hpp
syclik Oct 23, 2023
af52c7f
removing unused require_ from stan/math/prim/meta/is_constant.hpp
syclik Oct 23, 2023
4f83ba4
removing unused require_ from stan/math/prim/meta/is_container.hpp
syclik Oct 23, 2023
c5bde61
removing unused require_ from stan/math/prim/meta/is_container_or_var…
syclik Oct 23, 2023
fcdc1ba
removing unused require_ from stan/math/prim/meta/is_dense_dynamic.hpp
syclik Oct 23, 2023
96a972a
removing unused require_ from stan/math/prim/meta/is_double_or_int.hpp
syclik Oct 24, 2023
18c012d
removing unused require_ from stan/math/prim/meta/is_eigen.hpp
syclik Oct 24, 2023
0d19cba
removing unused require_ from stan/math/prim/meta/is_eigen_dense.hpp
syclik Oct 24, 2023
7dcc949
removing unused require_ from stan/math/prim/meta/is_eigen_dense_dyna…
syclik Oct 24, 2023
c00c47c
removing unused require_ from stan/math/prim/meta/is_eigen_matrix.hpp
syclik Oct 24, 2023
a5393bd
removing unused require_ from stan/math/prim/meta/is_eigen_matrix_bas…
syclik Oct 24, 2023
097f77b
removing unused require_ from stan/math/prim/meta/is_eigen_sparse_bas…
syclik Oct 24, 2023
fdb288c
removing unused require_ from stan/math/prim/meta/is_fvar.hpp
syclik Oct 24, 2023
f860153
removing unused require_ from stan/math/prim/meta/is_kernel_expressio…
syclik Oct 24, 2023
2e78376
removing unused require_ from stan/math/prim/meta/is_matrix.hpp
syclik Oct 24, 2023
335938c
removing unused require_ from stan/math/prim/meta/is_matrix_cl.hpp
syclik Oct 24, 2023
e6892e6
removing unused require_ from stan/math/prim/meta/is_plain_type.hpp
syclik Oct 24, 2023
0ee6a19
removing unused require_ from stan/math/prim/meta/is_rev_matrix.hpp
syclik Oct 24, 2023
d442821
removing unused require_ from stan/math/prim/meta/is_stan_scalar.hpp
syclik Oct 24, 2023
4b2b109
removing unused require_ from stan/math/prim/meta/is_stan_scalar_or_e…
syclik Oct 24, 2023
5c1c078
removing unused require_ from stan/math/prim/meta/is_string_convertib…
syclik Oct 24, 2023
b53b8c1
removing unused require_ from stan/math/prim/meta/is_tuple.hpp
syclik Oct 24, 2023
1ce7375
removing unused require_ from stan/math/prim/meta/is_var.hpp
syclik Oct 24, 2023
1c6ab83
removing unused require_ from stan/math/prim/meta/is_var_and_matrix_t…
syclik Oct 24, 2023
47a036b
removing unused require_ from stan/math/prim/meta/is_var_dense_dynami…
syclik Oct 24, 2023
05eb70e
removing unused require_ from stan/math/prim/meta/is_var_eigen.hpp
syclik Oct 24, 2023
ccb73dc
removing unused require_ from stan/math/prim/meta/is_var_matrix.hpp
syclik Oct 24, 2023
e10ec7c
removing unused require_ from stan/math/prim/meta/is_var_or_arithmeti…
syclik Oct 24, 2023
529787a
removing unused require_ from stan/math/prim/meta/is_vari.hpp
syclik Oct 24, 2023
d602663
removing unused require_ from stan/math/prim/meta/is_vector.hpp
syclik Oct 24, 2023
243c067
removing unused require_ from stan/math/prim/meta/is_vector_like.hpp
syclik Oct 24, 2023
c334aed
removing unused require_ from stan/math/prim/meta/require_generics.hpp
syclik Oct 24, 2023
b0a689e
adding back in require_not_same_t
syclik Nov 8, 2023
27cf52b
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
syclik Nov 29, 2023
6dcc5d7
wip: temp files
syclik Nov 1, 2023
291f056
adding back in require_vector_like_vt
syclik Nov 27, 2023
a328a97
adding back in require_all_not_tuple_t
syclik Nov 27, 2023
4cfbdf9
adding back in require_eigen_array_vt
syclik Nov 28, 2023
cc6f6d0
adding back in require_all_st_stan_scalar
syclik Nov 28, 2023
2eb7d88
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Nov 28, 2023
d8d92d6
adding back in require_all_var_t
syclik Nov 28, 2023
3291285
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Nov 28, 2023
a922690
adding back in require_any_not_var_t
syclik Nov 28, 2023
8d103bc
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Nov 28, 2023
5f3a7f2
adding back in some requires traits
syclik Nov 29, 2023
e336f40
removing tmp files
syclik Nov 29, 2023
43dbed7
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Nov 29, 2023
1f37599
adding back in some requires traits
syclik Dec 3, 2023
63baa5f
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Dec 3, 2023
032b135
adding back in a require trait that is used by Stan
syclik Dec 15, 2023
2e1804a
Merge commit 'c491e9b591d1c7fdc5176844c086ade0b13f2466' into HEAD
yashikno Dec 15, 2023
b6967ab
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Dec 15, 2023
7220894
adding back in requires trait
syclik Dec 16, 2023
4a8972e
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Dec 16, 2023
2b10934
added dirichlet_multinomial files and updated prob.hpp
chvandorp Nov 26, 2023
3a66d6c
correction in documentation for dirichlet_multinomial_lpmf
chvandorp Nov 27, 2023
ac7c2d2
added unit test. equivalence of BetaBinom and DirMult when K=2
chvandorp Nov 28, 2023
f4d88cf
cleaned up tests, added cases for lmpf test
chvandorp Nov 28, 2023
82070da
used clang-format to properly format the added files
chvandorp Nov 29, 2023
858057c
added AD test for dirichlet_multinomial_lpmf
chvandorp Dec 5, 2023
24221f4
Update vectorised handling, add analytical gradients
andrjohns Dec 13, 2023
7d7f4dc
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Dec 13, 2023
40151ac
style changes, removed _log file, optimized lpmf
chvandorp Dec 16, 2023
c9df636
Retry headers check and threading tests in case of failure. (#2982)
serban-nicusor-toptal Dec 17, 2023
32b814f
Bump actions/upload-artifact from 3 to 4
dependabot[bot] Dec 18, 2023
e5db7cb
Fix usages of fabs in check_symmetric with llvm17
WardBrian Dec 20, 2023
1ab9bc1
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Dec 20, 2023
eb7c393
removing STAN_ADD_REQUIRE_UNARY macro
syclik Jan 3, 2024
6a00303
removing STAN_ADD_REQUIRE_UNARY_INNER macro
syclik Jan 3, 2024
06763a3
removing STAN_ADD_REQUIRE_BINARY macro
syclik Jan 3, 2024
f83fa6a
removing STAN_ADD_REQUIRE_BINARY_INNER macro
syclik Jan 3, 2024
51c1a39
removing STAN_ADD_REQUIRE_CONTAINER macro
syclik Jan 3, 2024
62533fc
Merge commit 'ae90c3edca5d3b5e5234fdd6cbd1146f1666761d' into HEAD
yashikno Jan 3, 2024
61389e7
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Jan 3, 2024
4b19a97
Merge branch 'develop' into feature/simplify-meta
syclik Jan 11, 2024
58cab78
Merge branch 'develop' into feature/simplify-meta
syclik Jan 17, 2024
469f687
Merge branch 'develop' into feature/simplify-meta
syclik Jan 18, 2024
d10a379
updating shebang in python testing scripts to allow for direct execution
syclik Jan 18, 2024
c6ebb2f
correct makefile documentation (within the makefile). We no longer ne…
syclik Jan 18, 2024
ac8a645
updating shebang in python testing scripts to allow for direct execution
syclik Jan 18, 2024
af48cb6
updating shebang in more python scripts
syclik Jan 18, 2024
37d7799
adding checks for cholesky factors; we found problems with user-facin…
syclik Jan 13, 2024
8cd890f
Update wishart_cholesky_rng_test.cpp
spinkney Jan 17, 2024
44920e1
updating test; test was incorrect. It passed in a non-cholesky factor…
syclik Jan 17, 2024
9024040
passing expression tests
syclik Jan 19, 2024
232fd33
passing expression tests
syclik Jan 20, 2024
1f8f3be
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Jan 20, 2024
436b48e
release/v4.8.1: updating version numbers
Jan 23, 2024
8de3538
upgrading to boost v1.84.0; removing old boost library
andrjohns Jan 11, 2024
a123652
upgrading to boost v1.84.0; modifying with new version number
andrjohns Jan 11, 2024
07aed11
upgrading to boost v1.84.0; adding unmodified boost library
andrjohns Jan 11, 2024
62fb5de
upgrading to boost v1.84.0; pruning files
andrjohns Jan 11, 2024
f33fd3c
ibeta throw behaviour changed
andrjohns Jan 11, 2024
7ad7377
inv_inc_beta throw behaviour changed
andrjohns Jan 12, 2024
e4f5889
Fix exception in inv_wishart_cholesky test
WardBrian Jan 25, 2024
c1c2960
Re-add missing checks, revert test changes from #3007
WardBrian Jan 26, 2024
16bd832
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Jan 26, 2024
af90916
Ensure pointer is 8-byte aligned in stack_alloc::alloc
WardBrian Jan 26, 2024
2576d9e
Update stack_alloc_test
WardBrian Jan 26, 2024
5a534bf
Update doc
WardBrian Jan 26, 2024
9fe464c
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Jan 26, 2024
6741f9d
CVODES exceptions converted to domain_error
WardBrian Jan 25, 2024
8939593
Change test
WardBrian Jan 26, 2024
4140057
Use bessel identity to improve grad calc
andrjohns Jan 20, 2024
9aa7975
Update von mises test to use AD framework
andrjohns Jan 20, 2024
4c7c9f8
Patch TBB makefile, add testing workflow
andrjohns Jan 8, 2024
8c6fe65
Remove interim testing workflow
andrjohns Jan 8, 2024
1805449
Document changes
andrjohns Jan 8, 2024
80841b1
Remove additional stray usage
andrjohns Jan 8, 2024
fbc8f84
Move shell setting to makefile
andrjohns Jan 9, 2024
34fc8dd
Using rtools check
andrjohns Jan 9, 2024
1bbec87
mingw32-make compatible override
andrjohns Jan 9, 2024
986c8d8
Update notes
andrjohns Jan 9, 2024
e881b01
Alt sh check
andrjohns Jan 9, 2024
ca70c6e
Remove new unused boost libs, add to boost update script
WardBrian Jan 31, 2024
7a77bcf
Silence unused variable warning in Boost
WardBrian Jan 31, 2024
cba756e
Ensure workdir is clean after step, cat make/local before running run…
Feb 2, 2024
1fa5eb5
Change return type of linspaced_array
WardBrian Feb 6, 2024
9b19654
Update linspaced_array_test to actually test doubles
WardBrian Feb 6, 2024
93cc98e
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Feb 6, 2024
facb259
Fix copy/paste error in tests
WardBrian Feb 6, 2024
1800520
adding doc from @SteveBronder in the PR comments (with code formatting)
syclik Feb 10, 2024
7efb6ae
updating require_meta.md doc
syclik Feb 23, 2024
ca66d39
Merge branch 'develop' into feature/simplify-meta
syclik Feb 23, 2024
a8bb63e
adding code doc from @SteveBronder in the PR comments
syclik Feb 24, 2024
7f9e657
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Feb 24, 2024
4498a87
Merge branch 'develop' into feature/simplify-meta
syclik Mar 20, 2024
cc417ed
updating doxygen documentation about require traits
syclik Mar 24, 2024
cf4fd5e
Merge branch 'develop' into feature/simplify-meta
syclik Mar 24, 2024
7831559
adding require_eigen_matrix_base_t
syclik Mar 24, 2024
8efc7cf
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Mar 24, 2024
62ff9ae
adding require_not_assignable
syclik Mar 24, 2024
aaea3d8
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
stan-buildbot Mar 24, 2024
182cc29
Update doxygen/contributor_help_pages/require_meta.md
syclik Apr 2, 2024
0f77d06
Apply suggestions from code review
syclik Apr 2, 2024
a1d05d9
fixing meta doc
syclik Apr 2, 2024
b9309e7
updating doc
syclik Apr 2, 2024
2d1cb20
Update doxygen/contributor_help_pages/require_meta.md
syclik Apr 12, 2024
a2a19dc
Update doxygen/contributor_help_pages/require_meta.md
syclik Apr 12, 2024
dd75ad7
updating doc with edits from Steve Bronder
syclik Apr 12, 2024
66b92b5
updating doc
syclik Apr 12, 2024
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
476 changes: 359 additions & 117 deletions doxygen/contributor_help_pages/require_meta.md

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions stan/math/prim/meta/is_arena_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ namespace stan {
template <typename T, typename = void>
struct is_arena_matrix : std::false_type {};

STAN_ADD_REQUIRE_UNARY(arena_matrix, is_arena_matrix, require_eigens_types);
STAN_ADD_REQUIRE_CONTAINER(arena_matrix, is_arena_matrix, require_eigens_types);
STAN_ADD_REQUIRE_UNARY_INNER(arena_matrix, is_arena_matrix,
require_eigens_types);
/*! \ingroup require_eigen_types */
/*! \defgroup arena_matrix_types arena_matrix */
/*! \addtogroup arena_matrix_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_arena_matrix */
/*! @tparam T the type to check */
template <typename T>
using require_arena_matrix_t = require_t<is_arena_matrix<std::decay_t<T>>>;
/*! @} */

} // namespace stan
#endif
78 changes: 76 additions & 2 deletions stan/math/prim/meta/is_autodiff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,82 @@ struct is_autodiff
: bool_constant<math::disjunction<is_var<std::decay_t<T>>,
is_fvar<std::decay_t<T>>>::value> {};

STAN_ADD_REQUIRE_UNARY(autodiff, is_autodiff, require_stan_scalar_real);
STAN_ADD_REQUIRE_UNARY_INNER(autodiff, is_autodiff, require_stan_scalar_real);
/*! \ingroup require_stan_scalar_real */
/*! \defgroup autodiff_types autodiff */
/*! \addtogroup autodiff_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_autodiff */
/*! @tparam T the type to check */
template <typename T>
using require_autodiff_t = require_t<is_autodiff<std::decay_t<T>>>;

/*! \brief Require type does not satisfy @ref is_autodiff */
/*! @tparam T the type to check */
template <typename T>
using require_not_autodiff_t = require_not_t<is_autodiff<std::decay_t<T>>>;

/*! \brief Require all of the types satisfy @ref is_autodiff */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_autodiff_t
= require_all_t<is_autodiff<std::decay_t<Types>>...>;

/*! \brief Require any of the types satisfy @ref is_autodiff */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_autodiff_t
= require_any_t<is_autodiff<std::decay_t<Types>>...>;

/*! \brief Require none of the types satisfy @ref is_autodiff */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_not_autodiff_t
= require_all_not_t<is_autodiff<std::decay_t<Types>>...>;

/*! \brief Require at least one of the types do not satisfy @ref is_autodiff */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_not_autodiff_t
= require_any_not_t<is_autodiff<std::decay_t<Types>>...>;
/*! @} */

/*! \ingroup require_stan_scalar_real */
/*! \addtogroup autodiff_types */
/*! @{ */

/*! \brief Require value type does not satisfy @ref is_autodiff */
/*! @tparam T A type with a valid overload of @ref value_type available */
template <typename T>
using require_not_vt_autodiff
= require_not_t<is_autodiff<value_type_t<std::decay_t<T>>>>;

/*! \brief Require none of the value types satisfy @ref is_autodiff */
/*! @tparam Types The types with a valid overload of @ref value_type available
*/
template <typename... Types>
using require_all_not_vt_autodiff
= require_all_not_t<is_autodiff<value_type_t<std::decay_t<Types>>>...>;

/*! \brief Require scalar type satisfies @ref is_autodiff */
/*! @tparam T A type with a valid overload of @ref scalar_type available */
template <typename T>
using require_st_autodiff
= require_t<is_autodiff<scalar_type_t<std::decay_t<T>>>>;

/*! \brief Require scalar type does not satisfy @ref is_autodiff */
/*! @tparam T A type with a valid overload of @ref scalar_type available */
template <typename T>
using require_not_st_autodiff
= require_not_t<is_autodiff<scalar_type_t<std::decay_t<T>>>>;

/*! \brief Require any of the scalar types satisfy is_autodiff */
/*! @tparam Types The types with a valid overload of @ref scalar_type available
*/
template <typename... Types>
using require_any_st_autodiff
= require_any_t<is_autodiff<scalar_type_t<std::decay_t<Types>>>...>;
/*! @} */

} // namespace stan

Expand Down
55 changes: 53 additions & 2 deletions stan/math/prim/meta/is_complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,59 @@ struct scalar_type<T, std::enable_if_t<is_complex<T>::value>> {
using type = std::complex<typename std::decay_t<T>::value_type>;
};

STAN_ADD_REQUIRE_UNARY(complex, is_complex, require_stan_scalar_complex);
STAN_ADD_REQUIRE_UNARY_INNER(complex, is_complex, require_stan_scalar_complex);
/*! \ingroup require_stan_scalar_complex */
/*! \defgroup complex_types complex */
/*! \addtogroup complex_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_complex */
/*! @tparam T the type to check */
template <typename T>
using require_complex_t = require_t<is_complex<std::decay_t<T>>>;

/*! \brief Require type does not satisfy @ref is_complex */
/*! @tparam T the type to check */
template <typename T>
using require_not_complex_t = require_not_t<is_complex<std::decay_t<T>>>;

/*! \brief Require all of the types satisfy @ref is_complex */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_complex_t = require_all_t<is_complex<std::decay_t<Types>>...>;

/*! \brief Require any of the types satisfy @ref is_complex */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_complex_t = require_any_t<is_complex<std::decay_t<Types>>...>;

/*! \brief Require none of the types satisfy @ref is_complex */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_not_complex_t
= require_all_not_t<is_complex<std::decay_t<Types>>...>;
/*! @} */

/*! \ingroup require_stan_scalar_complex */
/*! \addtogroup complex_types */
/*! @{ */

/*! \brief Require value type satisfies @ref is_complex */
/*! @tparam T A type with a valid overload of @ref value_type available */
template <typename T>
using require_vt_complex = require_t<is_complex<value_type_t<std::decay_t<T>>>>;

/*! \brief Require value type does not satisfy @ref is_complex */
/*! @tparam T A type with a valid overload of @ref value_type available */
template <typename T>
using require_not_vt_complex
= require_not_t<is_complex<value_type_t<std::decay_t<T>>>>;

/*! \brief Require scalar type does not satisfy @ref is_complex */
/*! @tparam T A type with a valid overload of @ref scalar_type available */
template <typename T>
using require_not_st_complex
= require_not_t<is_complex<scalar_type_t<std::decay_t<T>>>>;
/*! @} */

/**
* If the `value_type` of the type `T` is of type
Expand Down
3 changes: 0 additions & 3 deletions stan/math/prim/meta/is_constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,5 @@ template <typename T>
struct is_constant<T, require_eigen_t<T>>
: bool_constant<is_constant<typename std::decay_t<T>::Scalar>::value> {};

STAN_ADD_REQUIRE_UNARY(constant, is_constant, require_stan_scalar_real);
STAN_ADD_REQUIRE_UNARY_INNER(constant, is_constant, require_stan_scalar_real);

} // namespace stan
#endif
61 changes: 59 additions & 2 deletions stan/math/prim/meta/is_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,65 @@ template <typename Container>
using is_container = bool_constant<
math::disjunction<is_eigen<Container>, is_std_vector<Container>>::value>;

STAN_ADD_REQUIRE_UNARY(container, is_container, general_types);
STAN_ADD_REQUIRE_CONTAINER(container, is_container, general_types);
/*! \ingroup general_types */
/*! \defgroup container_types container */
/*! \addtogroup container_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_container */
/*! @tparam T the type to check */
template <typename T>
using require_container_t = require_t<is_container<std::decay_t<T>>>;

/*! \brief Require type does not satisfy @ref is_container */
/*! @tparam T the type to check */
template <typename T>
using require_not_container_t = require_not_t<is_container<std::decay_t<T>>>;

/*! \brief Require all of the types satisfy @ref is_container */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_container_t
= require_all_t<is_container<std::decay_t<Types>>...>;

/*! \brief Require any of the types satisfy @ref is_container */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_container_t
= require_any_t<is_container<std::decay_t<Types>>...>;

/*! \brief Require none of the types satisfy @ref is_container */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_not_container_t
= require_all_not_t<is_container<std::decay_t<Types>>...>;
/*! @} */

/*! \ingroup general_types */
/*! \defgroup container_types container */
/*! \addtogroup container_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_container */
/*! and scalar type satisfies `TypeCheck` */
/*! @tparam TypeCheck The type trait to check the scalar type against */
/*! @tparam Check The type to test @ref is_container for and whose @ref
* scalar_type is checked with `TypeCheck` */
template <template <class...> class TypeCheck, class... Check>
using require_container_st
= require_t<container_type_check_base<is_container, scalar_type_t,
TypeCheck, Check...>>;

/*! \brief Require type does not satisfy @ref is_container */
/*! or scalar type does not satisfy `TypeCheck` */
/*! @tparam TypeCheck The type trait to check the scalar type against */
/*! @tparam Check The type to test @ref is_container for and whose @ref
* scalar_type is checked with `TypeCheck` */
template <template <class...> class TypeCheck, class... Check>
using require_not_container_st
= require_not_t<container_type_check_base<is_container, scalar_type_t,
TypeCheck, Check...>>;
/*! @} */

} // namespace stan

Expand Down
5 changes: 0 additions & 5 deletions stan/math/prim/meta/is_container_or_var_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ using is_container_or_var_matrix
= bool_constant<math::disjunction<is_container<Container>,
is_var_matrix<Container>>::value>;

STAN_ADD_REQUIRE_UNARY(container_or_var_matrix, is_container_or_var_matrix,
general_types);
STAN_ADD_REQUIRE_CONTAINER(container_or_var_matrix, is_container_or_var_matrix,
general_types);

} // namespace stan

#endif
19 changes: 16 additions & 3 deletions stan/math/prim/meta/is_dense_dynamic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,22 @@ struct is_dense_dynamic_impl<T, require_t<is_var<T>>>
template <typename T>
using is_dense_dynamic = internal::is_dense_dynamic_impl<std::decay_t<T>>;

STAN_ADD_REQUIRE_UNARY(dense_dynamic, is_dense_dynamic, require_eigens_types);
STAN_ADD_REQUIRE_CONTAINER(dense_dynamic, is_dense_dynamic,
require_eigens_types);
/*! \ingroup require_eigens_types */
/*! \defgroup dense_dynamic_types dense_dynamic */
/*! \addtogroup dense_dynamic_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_dense_dynamic */
/*! @tparam T the type to check */
template <typename T>
using require_dense_dynamic_t = require_t<is_dense_dynamic<std::decay_t<T>>>;

/*! \brief Require all of the types satisfy @ref is_dense_dynamic */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_dense_dynamic_t
= require_all_t<is_dense_dynamic<std::decay_t<Types>>...>;
/*! @} */

} // namespace stan

Expand Down
45 changes: 41 additions & 4 deletions stan/math/prim/meta/is_double_or_int.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,47 @@ struct is_double_or_int
math::disjunction<std::is_same<double, std::decay_t<T>>,
std::is_same<int, std::decay_t<T>>>::value> {};

STAN_ADD_REQUIRE_UNARY(double_or_int, is_double_or_int,
require_stan_scalar_real);
STAN_ADD_REQUIRE_UNARY_INNER(double_or_int, is_double_or_int,
require_stan_scalar_real);
/*! \ingroup require_stan_scalar_real */
/*! \defgroup double_or_int_types double_or_int */
/*! \addtogroup double_or_int_types */
/*! @{ */

/*! \brief Require type satisfies @ref is_double_or_int */
/*! @tparam T the type to check */
template <typename T>
using require_double_or_int_t = require_t<is_double_or_int<std::decay_t<T>>>;

/*! \brief Require type does not satisfy @ref is_double_or_int */
/*! @tparam T the type to check */
template <typename T>
using require_not_double_or_int_t
= require_not_t<is_double_or_int<std::decay_t<T>>>;

/*! \brief Require all of the types satisfy @ref is_double_or_int */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_double_or_int_t
= require_all_t<is_double_or_int<std::decay_t<Types>>...>;

/*! \brief Require any of the types satisfy @ref is_double_or_int */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_double_or_int_t
= require_any_t<is_double_or_int<std::decay_t<Types>>...>;

/*! \brief Require none of the types satisfy @ref is_double_or_int */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_all_not_double_or_int_t
= require_all_not_t<is_double_or_int<std::decay_t<Types>>...>;

/*! \brief Require at least one of the types do not satisfy @ref
* is_double_or_int */
/*! @tparam Types The types that are checked */
template <typename... Types>
using require_any_not_double_or_int_t
= require_any_not_t<is_double_or_int<std::decay_t<Types>>...>;
/*! @} */

} // namespace stan
#endif
Loading