Stan Math Library
4.9.0
Automatic Differentiation
|
The OpenCL kernel generator is used to combine multiple matrix operations into a single OpenCL kernel.
This is much simpler than writing multi-operation kernels by hand.
Because global GPU memory loads and stores are relativly slow compared to calculations in a kernel, using one kernel for multiple operations is faster than using one kernel per operation.
The kernel generator uses lazy evaluation. Each operation is represented by an object derived from operation_cl
. Such an object holds arguments of the operations as well as meta information needed to generate calculations on the arguments. Arguments to operations can be other operations, scalars or matrix_cl
objects. An operation is evaluated when either an operation is assigned to a matrix_cl
or a left-hand-side operation or .eval()
is called.
Element-wise functions can be added using one of the macros in elt_functions.hpp
.
New kernel generator classes must satsify the conditions below:
operation_cl
. Optionally, if the operation should support being assigned to, it can be derived from a class inheriting operation_cl_lhs
instead.Scalar
should be defined as scalar type of the result of the operation.deep_copy
should make a copy of the expression. Arguments that are operations should be copied by calling their deep_copy
.The following functions can optionally be defined. Defaults are implemented in operation_cl
:
kernel_parts generate(const std::string& i, const std::string& j, const std::string& var_name_arg)
:void modify_argument_indices(std::string& i, std::string& j)
:generate()
.void set_args(std::set<const operation_cl_base*>& generated, cl::Kernel& kernel, int& arg_num)
:set_args()
on arguments.int rows()
:int cols()
:int thread_rows()
:rows()
.int thread_cols()
:cols()
.std::pair<int,int> extreme_diagonals()
:load_
of a matrix with lower triangular view would return bottom diagonal of 1-rows()
and top diagonal 0
. Returning a more extreme value is also allowed and especially useful for operations that are broadcast so their exact size is not known.The below functions can be optionally defined for operations that support being assigned to. Defaults are in operation_cl_lhs
.
kernel_parts generate_lhs(const std::string& i, const std::string& j, const std::string& var_name_arg)
:void set_view(int bottom_diagonal, int top_diagonal, int
bottom_zero_diagonal, int top_zero_diagonal)
:matrix_cl
depending on where the extreme sub-/super-diagonals are written.set_view
on expression arguments with the same arguments.void check_assign_dimensions(int rows, int cols)
:check_assign_dimensions
on expression arguments with the same arguments.A new operation should also have a user-facing function that accepts arguments to the operation and returns the operation object. Arguments should be passed trough function as_operation_cl
so that they are wrapped in operations if they are not operations themselves. If the operation defines modify_argument_indices
this function should make copies of arguments by calling deep_copy()
on them internally.
Modules | |
kernel_expression_lhs <br> | |
rev_kernel_expression <br> | |
prim_or_rev_kernel_expression | |
Nonscalar_prim_or_rev_kernel_expression_types | |
Namespaces | |
namespace | stan::math::internal |
A comparator that works for any container type that has the brackets operator. | |
Macros | |
#define | COMMA , |
This macro is used to allow passing comma as part of a parameter in another macro. | |
#define | ADD_BINARY_OPERATION(class_name, function_name, scalar_type_expr, operation) |
Defines a new binary operation in kernel generator. | |
#define | ADD_BINARY_OPERATION_WITH_CUSTOM_CODE( class_name, function_name, scalar_type_expr, operation, ...) |
Defines a new binary operation in kernel generator that needs to implement custom function that determines the view of the result. | |
#define | ADD_BINARY_FUNCTION_WITH_INCLUDES(fun, ...) |
Generates a class and function for a general binary function that is defined by OpenCL or in the included code. | |
#define | ADD_UNARY_FUNCTION_WITH_INCLUDES(fun, ...) |
Generates a class and function for a general unary function that is defined by OpenCL or in the included code. | |
#define | ADD_UNARY_FUNCTION(fun) ADD_UNARY_FUNCTION_WITH_INCLUDES(fun) |
Generates a class and function for a general unary function that is defined by OpenCL. | |
#define | ADD_UNARY_FUNCTION_PASS_ZERO(fun) |
Generates a class and function for an unary function, defined by OpenCL with special property that it passes trough zero. | |
#define | ADD_CLASSIFICATION_FUNCTION(fun, ...) |
Generates a class and function for a classification function, defined by OpenCL. | |
Typedefs | |
using | stan::math::append_row_< T_a, T_b >::Scalar = common_scalar_t< T_a, T_b > |
using | stan::math::append_row_< T_a, T_b >::base = operation_cl< append_row_< T_a, T_b >, Scalar, T_a, T_b > |
using | stan::math::append_col_< T_a, T_b >::Scalar = common_scalar_t< T_a, T_b > |
using | stan::math::append_col_< T_a, T_b >::base = operation_cl< append_col_< T_a, T_b >, Scalar, T_a, T_b > |
template<typename T , assign_op_cl AssignOp = assign_op_cl::equals> | |
using | stan::math::as_operation_cl_t = std::conditional_t< std::is_lvalue_reference< T >::value, decltype(as_operation_cl< AssignOp >(std::declval< T >())), std::remove_reference_t< decltype(as_operation_cl< AssignOp >(std::declval< T >()))> > |
Type that results when converting any valid kernel generator expression into operation. | |
template<typename T > | |
using | stan::math::is_without_output = internal::is_without_output_impl< std::decay_t< T > > |
template<typename T > | |
using | stan::math::is_colwise_reduction = internal::is_colwise_reduction_impl< std::decay_t< T > > |
Check whether a kernel generator expression is a colwise reduction. | |
template<typename T > | |
using | stan::math::is_reduction_2d = internal::is_reduction_2d_impl< std::decay_t< T > > |
Check whether a kernel generator expression is a colwise reduction. | |
template<typename... Types> | |
using | stan::require_all_kernel_expressions_and_none_scalar_t = require_all_t< is_kernel_expression_and_not_scalar< Types >... > |
Enables a template if all given types are non-scalar types that are a valid kernel generator expressions. | |
template<typename... Types> | |
using | stan::require_all_kernel_expressions_t = require_all_t< is_kernel_expression< Types >... > |
Enables a template if all given types are are a valid kernel generator expressions. | |
Functions | |
stan::math::append_row_< T_a, T_b >::append_row_ (T_a &&a, T_b &&b) | |
Constructor. | |
auto | stan::math::append_row_< T_a, T_b >::deep_copy () const |
Creates a deep copy of this expression. | |
kernel_parts | stan::math::append_row_< T_a, T_b >::get_kernel_parts (std::unordered_map< const void *, const char * > &generated, std::unordered_map< const void *, const char * > &generated_all, name_generator &name_gen, const std::string &row_index_name, const std::string &col_index_name, bool view_handled) const |
Generates kernel code for this and nested expressions. | |
void | stan::math::append_row_< T_a, T_b >::set_args (std::unordered_map< const void *, const char * > &generated, std::unordered_map< const void *, const char * > &generated_all, cl::Kernel &kernel, int &arg_num) const |
Sets kernel arguments for this and nested expressions. | |
int | stan::math::append_row_< T_a, T_b >::rows () const |
Number of rows of a matrix that would be the result of evaluating this expression. | |
std::pair< int, int > | stan::math::append_row_< T_a, T_b >::extreme_diagonals () const |
Determine indices of extreme sub- and superdiagonals written. | |
template<typename Ta , typename Tb , typename = require_all_kernel_expressions_and_none_scalar_t<Ta, Tb>> | |
auto | stan::math::append_row (Ta &&a, Tb &&b) |
Stack the rows of the first argument on top of the second argument. | |
stan::math::append_col_< T_a, T_b >::append_col_ (T_a &&a, T_b &&b) | |
Constructor. | |
auto | stan::math::append_col_< T_a, T_b >::deep_copy () const |
Creates a deep copy of this expression. | |
kernel_parts | stan::math::append_col_< T_a, T_b >::get_kernel_parts (std::unordered_map< const void *, const char * > &generated, std::unordered_map< const void *, const char * > &generated_all, name_generator &name_gen, const std::string &row_index_name, const std::string &col_index_name, bool view_handled) const |
Generates kernel code for this and nested expressions. | |
void | stan::math::append_col_< T_a, T_b >::set_args (std::unordered_map< const void *, const char * > &generated, std::unordered_map< const void *, const char * > &generated_all, cl::Kernel &kernel, int &arg_num) const |
Sets kernel arguments for this and nested expressions. | |
int | stan::math::append_col_< T_a, T_b >::cols () const |
Number of rows of a matrix that would be the result of evaluating this expression. | |
std::pair< int, int > | stan::math::append_col_< T_a, T_b >::extreme_diagonals () const |
Determine indices of extreme sub- and superdiagonals written. | |
template<typename Ta , typename Tb , typename = require_all_kernel_expressions_and_none_scalar_t<Ta, Tb>> | |
auto | stan::math::append_col (Ta &&a, Tb &&b) |
Stack the cols of the arguments. | |
template<typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr> | |
auto | stan::math::as_column_vector_or_scalar (T &&a) |
as_column_vector_or_scalar of a kernel generator expression. | |
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_operation , typename = std::enable_if_t<std::is_base_of< operation_cl_base, std::remove_reference_t<T_operation>>::value>> | |
T_operation && | stan::math::as_operation_cl (T_operation &&a) |
Converts any valid kernel generator expression into an operation. | |
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_scalar , typename = require_arithmetic_t<T_scalar>, require_not_same_t< T_scalar, bool > * = nullptr> | |
scalar_< T_scalar > | stan::math::as_operation_cl (const T_scalar a) |
Converts any valid kernel generator expression into an operation. | |
template<assign_op_cl AssignOp = assign_op_cl::equals> | |
scalar_< char > | stan::math::as_operation_cl (const bool a) |
Converts any valid kernel generator expression into an operation. | |
template<assign_op_cl AssignOp = assign_op_cl::equals, typename T_matrix_cl , typename = require_any_t<is_matrix_cl<T_matrix_cl>, is_arena_matrix_cl<T_matrix_cl>>> | |
load_< T_matrix_cl, AssignOp > | stan::math::as_operation_cl (T_matrix_cl &&a) |
Converts any valid kernel generator expression into an operation. | |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
addition_operator_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator+ (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
addition_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::add (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
subtraction_operator_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator- (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
subtraction_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::subtract (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::elt_multiply (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
elt_divide_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::elt_divide (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
elt_modulo_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator% (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
less_than_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator< (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
less_than_or_equal_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator<= (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
greater_than_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator> (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
greater_than_or_equal_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator>= (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
equals_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator== (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
not_equals_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator!= (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
logical_or_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator|| (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , require_all_kernel_expressions_t< T_a, T_b > * = nullptr, require_any_not_arithmetic_t< T_a, T_b > * = nullptr> | |
logical_and_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator&& (T_a &&a, T_b &&b) |
template<typename T_a , typename T_b , typename = require_arithmetic_t<T_a>, typename = require_all_kernel_expressions_t<T_b>> | |
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator* (T_a a, T_b &&b) |
Multiplication of a scalar and a kernel generator expression. | |
template<typename T_a , typename T_b , typename = require_all_kernel_expressions_t<T_a>, typename = require_arithmetic_t<T_b>> | |
elt_multiply_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > | stan::math::operator* (T_a &&a, const T_b b) |
Multiplication of a kernel generator expression and a scalar. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::block_zero_based (T &&a, int start_row, int start_col, int rows, int cols) |
Block of a kernel generator expression. | |
template<bool Colwise, bool Rowwise, typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::broadcast (T &&a) |
Broadcast an expression in specified dimension(s). | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::rowwise_broadcast (T &&a) |
Broadcast an expression in rowwise dimmension. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::colwise_broadcast (T &&a) |
Broadcast an expression in colwise dimmension. | |
template<bool Do_Calculate, typename T , require_all_kernel_expressions_t< T > * = nullptr, std::enable_if_t< Do_Calculate > * = nullptr> | |
calc_if_< true, as_operation_cl_t< T > > | stan::math::calc_if (T &&a) |
template<bool Do_Calculate, typename T , std::enable_if_t<!Do_Calculate > * = nullptr> | |
calc_if_< false, scalar_< double > > | stan::math::calc_if (T &&a) |
template<typename Scalar , typename T , require_all_kernel_expressions_and_none_scalar_t< T > * = nullptr> | |
auto | stan::math::cast (T &&a) |
Typecast a kernel generator expression scalar. | |
template<typename Scalar , typename T , require_stan_scalar_t< T > * = nullptr> | |
Scalar | stan::math::cast (T a) |
Typecast a scalar. | |
template<typename T , typename = require_all_kernel_expressions_t<T>> | |
auto | stan::math::check_cl (const char *function, const char *var_name, T &&y, const char *must_be) |
Constructs a check on opencl matrix or expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::colwise_sum (T &&a) |
Column wise sum - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::colwise_prod (T &&a) |
Column wise product - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::colwise_max (T &&a) |
Column wise max - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::colwise_min (T &&a) |
Column wise min - reduction of a kernel generator expression. | |
template<typename T , typename = require_arithmetic_t<T>> | |
auto | stan::math::constant (const T a, int rows, int cols) |
Matrix of repeated values in kernel generator expressions. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::diagonal (T &&a) |
Diagonal of a kernel generator expression. | |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
rsqrt_< as_operation_cl_t< T > > | stan::math::rsqrt (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
sqrt_< as_operation_cl_t< T > > | stan::math::sqrt (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
cbrt_< as_operation_cl_t< T > > | stan::math::cbrt (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
exp_< as_operation_cl_t< T > > | stan::math::exp (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
exp2_< as_operation_cl_t< T > > | stan::math::exp2 (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
expm1_< as_operation_cl_t< T > > | stan::math::expm1 (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log_< as_operation_cl_t< T > > | stan::math::log (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log2_< as_operation_cl_t< T > > | stan::math::log2 (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log10_< as_operation_cl_t< T > > | stan::math::log10 (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log1p_< as_operation_cl_t< T > > | stan::math::log1p (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
sin_< as_operation_cl_t< T > > | stan::math::sin (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
sinh_< as_operation_cl_t< T > > | stan::math::sinh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
cos_< as_operation_cl_t< T > > | stan::math::cos (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
cosh_< as_operation_cl_t< T > > | stan::math::cosh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
tan_< as_operation_cl_t< T > > | stan::math::tan (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
tanh_< as_operation_cl_t< T > > | stan::math::tanh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
asin_< as_operation_cl_t< T > > | stan::math::asin (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
asinh_< as_operation_cl_t< T > > | stan::math::asinh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
acos_< as_operation_cl_t< T > > | stan::math::acos (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
acosh_< as_operation_cl_t< T > > | stan::math::acosh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
atan_< as_operation_cl_t< T > > | stan::math::atan (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
atanh_< as_operation_cl_t< T > > | stan::math::atanh (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
tgamma_< as_operation_cl_t< T > > | stan::math::tgamma (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
lgamma_< as_operation_cl_t< T > > | stan::math::lgamma (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
erf_< as_operation_cl_t< T > > | stan::math::erf (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
erfc_< as_operation_cl_t< T > > | stan::math::erfc (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
floor_< as_operation_cl_t< T > > | stan::math::floor (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
round_< as_operation_cl_t< T > > | stan::math::round (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
ceil_< as_operation_cl_t< T > > | stan::math::ceil (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
fabs_< as_operation_cl_t< T > > | stan::math::fabs (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
trunc_< as_operation_cl_t< T > > | stan::math::trunc (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
digamma_< as_operation_cl_t< T > > | stan::math::digamma (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log1m_< as_operation_cl_t< T > > | stan::math::log1m (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log_inv_logit_< as_operation_cl_t< T > > | stan::math::log_inv_logit (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log1m_exp_< as_operation_cl_t< T > > | stan::math::log1m_exp (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log1p_exp_< as_operation_cl_t< T > > | stan::math::log1p_exp (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
inv_square_< as_operation_cl_t< T > > | stan::math::inv_square (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
inv_logit_< as_operation_cl_t< T > > | stan::math::inv_logit (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
logit_< as_operation_cl_t< T > > | stan::math::logit (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
Phi_< as_operation_cl_t< T > > | stan::math::Phi (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
Phi_approx_< as_operation_cl_t< T > > | stan::math::Phi_approx (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
inv_Phi_< as_operation_cl_t< T > > | stan::math::inv_Phi (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
log1m_inv_logit_< as_operation_cl_t< T > > | stan::math::log1m_inv_logit (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
trigamma_< as_operation_cl_t< T > > | stan::math::trigamma (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
square_< as_operation_cl_t< T > > | stan::math::square (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
isfinite_< as_operation_cl_t< T > > | stan::math::isfinite (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
isinf_< as_operation_cl_t< T > > | stan::math::isinf (T &&a) |
template<typename T , typename Cond = require_all_kernel_expressions_and_none_scalar_t<T>> | |
isnan_< as_operation_cl_t< T > > | stan::math::isnan (T &&a) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
fdim_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::fdim (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
fmax_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::fmax (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
fmin_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::fmin (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
fmod_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::fmod (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
hypot_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::hypot (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
ldexp_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::ldexp (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
pow_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::pow (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
copysign_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::copysign (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
beta_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::beta (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
binomial_coefficient_log_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::binomial_coefficient_log (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
lbeta_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::lbeta (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
log_inv_logit_diff_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::log_inv_logit_diff (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
log_diff_exp_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::log_diff_exp (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
multiply_log_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::multiply_log (T1 &&a, T2 &&b) |
template<typename T1 , typename T2 , require_all_kernel_expressions_t< T1, T2 > * = nullptr, require_any_not_stan_scalar_t< T1, T2 > * = nullptr> | |
lmultiply_< as_operation_cl_t< T1 >, as_operation_cl_t< T2 > > | stan::math::lmultiply (T1 &&a, T2 &&b) |
template<typename T , typename... Ptrs, require_all_kernel_expressions_t< T, Ptrs... > * = nullptr> | |
auto | stan::math::holder_cl (T &&a, Ptrs *... ptrs) |
Constructs a no-op operation that also holds pointer to some other expressions, allocated on heap. | |
template<typename T , typename... Args, require_all_kernel_expressions_t< decltype(std::declval< T >()(std::declval< Args & >()...)), Args... > * = nullptr> | |
auto | stan::math::make_holder_cl (const T &func, Args &&... args) |
Constructs an expression from given arguments using given functor. | |
template<typename T_mat , typename T_row_index , typename T_col_index , require_all_kernel_expressions_t< T_mat, T_row_index, T_col_index > * = nullptr> | |
auto | stan::math::indexing (T_mat &&mat, T_row_index &&row_index, T_col_index &&col_index) |
Index a kernel generator expression using two expressions for indices. | |
template<typename... T_expressions> | |
expressions_cl< T_expressions... > | stan::math::expressions (T_expressions &&... expressions) |
Deduces types for constructing expressions_cl object. | |
template<typename... T_results> | |
results_cl< T_results... > | stan::math::results (T_results &&... results) |
Deduces types for constructing results_cl object. | |
template<const char * Code, typename... T_arguments, require_all_kernel_expressions_t< T_arguments... > * = nullptr> | |
auto | stan::math::opencl_code (std::tuple< typename std::pair< const char *, T_arguments >::first_type... > names, T_arguments &&... arguments) |
Custom code in kernel generator expressions. | |
std::ostream & | stan::math::operator<< (std::ostream &os, kernel_parts &parts) |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::sum_2d (T &&a) |
Two dimensional sum - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::prod_2d (T &&a) |
Two dimensional product - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::max_2d (T &&a) |
Two dimensional max - reduction of a kernel generator expression. | |
template<typename T , require_all_kernel_expressions_t< T > * = nullptr> | |
auto | stan::math::min_2d (T &&a) |
Two dimensional min - reduction of a kernel generator expression. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::rowwise_sum (T &&a) |
Rowwise sum reduction of a kernel generator expression. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::rowwise_prod (T &&a) |
Rowwise product reduction of a kernel generator expression. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::rowwise_max (T &&a) |
Rowwise max reduction of a kernel generator expression. | |
template<typename T , typename = require_all_kernel_expressions_and_none_scalar_t<T>> | |
auto | stan::math::rowwise_min (T &&a) |
Min reduction of a kernel generator expression. | |
template<typename T_condition , typename T_then , typename T_else , require_all_kernel_expressions_t< T_condition, T_then, T_else > * = nullptr, require_any_not_arithmetic_t< T_condition, T_then, T_else > * = nullptr> | |
select_< as_operation_cl_t< T_condition >, as_operation_cl_t< T_then >, as_operation_cl_t< T_else > > | stan::math::select (T_condition &&condition, T_then &&then, T_else &&els) |
Selection operation on kernel generator expressions. | |
template<typename Arg , typename = require_all_kernel_expressions_and_none_scalar_t<Arg>> | |
auto | stan::math::transpose (Arg &&a) |
Transposes a kernel generator expression. | |
template<typename T_lhs > | |
void | stan::math::operation_cl< Derived, Scalar, Args >::evaluate_into (T_lhs &lhs) const |
Evaluates this expression into given left-hand-side expression. | |
template<typename T_lhs > | |
std::string | stan::math::operation_cl< Derived, Scalar, Args >::get_kernel_source_for_evaluating_into (const T_lhs &lhs) const |
Generates kernel source for evaluating this expression into given left-hand-side expression. | |
template<typename Expr , require_all_kernel_expressions_and_none_scalar_t< Expr > * = nullptr, require_not_matrix_cl_t< Expr > * = nullptr> | |
stan::math::matrix_cl< T >::matrix_cl (const Expr &expression) | |
Construct from a kernel generator expression. | |
template<typename Expr , require_all_kernel_expressions_and_none_scalar_t< Expr > * = nullptr, require_not_matrix_cl_t< Expr > * = nullptr> | |
matrix_cl< T > & | stan::math::matrix_cl< T >::operator= (const Expr &expression) |
Assignment of a kernel generator expression evaluates the expression into this . | |
void | stan::math::check_cl_< T >::operator= (bool condition) |
Assignment of a scalar bool triggers the scalar check. | |
Variables | |
static const std::vector< const char * > | stan::math::rsqrt_< T >::includes {} |
static const std::vector< const char * > | stan::math::sqrt_< T >::includes {} |
static const std::vector< const char * > | stan::math::cbrt_< T >::includes {} |
static const std::vector< const char * > | stan::math::exp_< T >::includes {} |
static const std::vector< const char * > | stan::math::exp2_< T >::includes {} |
static const std::vector< const char * > | stan::math::expm1_< T >::includes {} |
static const std::vector< const char * > | stan::math::log_< T >::includes {} |
static const std::vector< const char * > | stan::math::log2_< T >::includes {} |
static const std::vector< const char * > | stan::math::log10_< T >::includes {} |
static const std::vector< const char * > | stan::math::log1p_< T >::includes {} |
static const std::vector< const char * > | stan::math::sin_< T >::includes {} |
static const std::vector< const char * > | stan::math::sinh_< T >::includes {} |
static const std::vector< const char * > | stan::math::cos_< T >::includes {} |
static const std::vector< const char * > | stan::math::cosh_< T >::includes {} |
static const std::vector< const char * > | stan::math::tan_< T >::includes {} |
static const std::vector< const char * > | stan::math::tanh_< T >::includes {} |
static const std::vector< const char * > | stan::math::asin_< T >::includes {} |
static const std::vector< const char * > | stan::math::asinh_< T >::includes {} |
static const std::vector< const char * > | stan::math::acos_< T >::includes {} |
static const std::vector< const char * > | stan::math::acosh_< T >::includes {} |
static const std::vector< const char * > | stan::math::atan_< T >::includes {} |
static const std::vector< const char * > | stan::math::atanh_< T >::includes {} |
static const std::vector< const char * > | stan::math::tgamma_< T >::includes {} |
static const std::vector< const char * > | stan::math::lgamma_< T >::includes {} |
static const std::vector< const char * > | stan::math::erf_< T >::includes {} |
static const std::vector< const char * > | stan::math::erfc_< T >::includes {} |
static const std::vector< const char * > | stan::math::floor_< T >::includes {} |
static const std::vector< const char * > | stan::math::round_< T >::includes {} |
static const std::vector< const char * > | stan::math::ceil_< T >::includes {} |
static const std::vector< const char * > | stan::math::fabs_< T >::includes {} |
static const std::vector< const char * > | stan::math::trunc_< T >::includes {} |
static const std::vector< const char * > | stan::math::digamma_< T >::includes { opencl_kernels::digamma_device_function } |
static const std::vector< const char * > | stan::math::log1m_< T >::includes { opencl_kernels::log1m_device_function } |
static const std::vector< const char * > | stan::math::log_inv_logit_< T >::includes { opencl_kernels::log1p_exp_device_function, opencl_kernels::log_inv_logit_device_function } |
static const std::vector< const char * > | stan::math::log1m_exp_< T >::includes { opencl_kernels::log1m_exp_device_function } |
static const std::vector< const char * > | stan::math::log1p_exp_< T >::includes { opencl_kernels::log1p_exp_device_function } |
static const std::vector< const char * > | stan::math::inv_square_< T >::includes { opencl_kernels::inv_square_device_function } |
static const std::vector< const char * > | stan::math::inv_logit_< T >::includes { opencl_kernels::inv_logit_device_function } |
static const std::vector< const char * > | stan::math::logit_< T >::includes { opencl_kernels::log1m_device_function, opencl_kernels::logit_device_function } |
static const std::vector< const char * > | stan::math::Phi_< T >::includes { opencl_kernels::phi_device_function } |
static const std::vector< const char * > | stan::math::Phi_approx_< T >::includes { opencl_kernels::inv_logit_device_function, opencl_kernels::phi_approx_device_function } |
static const std::vector< const char * > | stan::math::inv_Phi_< T >::includes { opencl_kernels::log1m_device_function, opencl_kernels::phi_device_function, opencl_kernels::inv_phi_device_function } |
static const std::vector< const char * > | stan::math::log1m_inv_logit_< T >::includes { opencl_kernels::log1p_exp_device_function, opencl_kernels::log1m_inv_logit_device_function } |
static const std::vector< const char * > | stan::math::trigamma_< T >::includes { opencl_kernels::trigamma_device_function } |
static const std::vector< const char * > | stan::math::square_< T >::includes { "\n#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_SQUARE\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_SQUARE\n" "double square(double x){return x*x;}\n" "#endif\n" } |
static const std::vector< const char * > | stan::math::isfinite_< T >::includes {} |
static const std::vector< const char * > | stan::math::isinf_< T >::includes {} |
static const std::vector< const char * > | stan::math::isnan_< T >::includes {} |
static const std::vector< const char * > | stan::math::fdim_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::fmax_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::fmin_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::fmod_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::hypot_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::ldexp_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::pow_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::copysign_< T1, T2 >::includes {} |
static const std::vector< const char * > | stan::math::beta_< T1, T2 >::includes { stan::math::opencl_kernels::beta_device_function } |
static const std::vector< const char * > | stan::math::binomial_coefficient_log_< T1, T2 >::includes { stan::math::opencl_kernels::lgamma_stirling_device_function, stan::math::opencl_kernels::lgamma_stirling_diff_device_function, stan::math::opencl_kernels::lbeta_device_function, stan::math::opencl_kernels::binomial_coefficient_log_device_function } |
static const std::vector< const char * > | stan::math::lbeta_< T1, T2 >::includes { stan::math::opencl_kernels::lgamma_stirling_device_function, stan::math::opencl_kernels::lgamma_stirling_diff_device_function, stan::math::opencl_kernels::lbeta_device_function } |
static const std::vector< const char * > | stan::math::log_inv_logit_diff_< T1, T2 >::includes { opencl_kernels::log1p_exp_device_function, opencl_kernels::log1m_exp_device_function, opencl_kernels::log_inv_logit_diff_device_function } |
static const std::vector< const char * > | stan::math::log_diff_exp_< T1, T2 >::includes { opencl_kernels::log1m_exp_device_function, opencl_kernels::log_diff_exp_device_function } |
static const std::vector< const char * > | stan::math::multiply_log_< T1, T2 >::includes { stan::math::opencl_kernels::multiply_log_device_function } |
static const std::vector< const char * > | stan::math::lmultiply_< T1, T2 >::includes { stan::math::opencl_kernels::lmultiply_device_function } |
static const bool | stan::math::operation_cl< Derived, Scalar, Args >::require_specific_local_size |