1#ifndef STAN_MATH_OPENCL_KERNEL_GENERATOR_DIAGONAL_HPP
2#define STAN_MATH_OPENCL_KERNEL_GENERATOR_DIAGONAL_HPP
34 typename std::remove_reference_t<T>::Scalar, T> {
36 using Scalar =
typename std::remove_reference_t<T>::Scalar;
39 using base::operator=;
52 auto&& arg_copy = this->
template get_arg<0>().deep_copy();
53 return diagonal_<std::remove_reference_t<
decltype(arg_copy)>>{
64 std::string& col_index_name)
const {
65 col_index_name = row_index_name;
74 return std::min(this->
template get_arg<0>().
rows(),
75 this->
template get_arg<0>().
cols());
83 inline int cols()
const {
return 1; }
100 inline void set_view(
int bottom_diagonal,
int top_diagonal,
101 int bottom_zero_diagonal,
int top_zero_diagonal)
const {}
108 return {1 -
rows(), 1};
120 "diagonal", this->
rows(),
"rows of ",
"expression", rows);
122 "diagonal", 1,
"columns of ",
"expression",
cols);
138 return diagonal_<std::remove_reference_t<
decltype(a_operation)>>(
139 std::move(a_operation));
auto deep_copy() const
Creates a deep copy of this expression.
std::pair< int, int > extreme_diagonals() const
Determine indices of extreme sub- and superdiagonals written.
int cols() const
Number of columns of a matrix that would be the result of evaluating this expression.
int rows() const
Number of rows of a matrix that would be the result of evaluating this expression.
typename std::remove_reference_t< T >::Scalar Scalar
void modify_argument_indices(std::string &row_index_name, std::string &col_index_name) const
Sets col_index_name to value of row_index_name.
void check_assign_dimensions(int rows, int cols) const
Checks if desired dimensions match dimensions of the block.
void set_view(int bottom_diagonal, int top_diagonal, int bottom_zero_diagonal, int top_zero_diagonal) const
Sets the view of the underlying matrix depending on which of its parts are written to.
diagonal_(T &&a)
Constructor.
Represents diagonal of a matrix (as column vector) in kernel generator expressions.
Base for all kernel generator operations that can be used on left hand side of an expression.
auto diagonal(T &&a)
Diagonal of a kernel generator expression.
T_operation && as_operation_cl(T_operation &&a)
Converts any valid kernel generator expression into an operation.
require_all_t< is_kernel_expression_and_not_scalar< Types >... > require_all_kernel_expressions_and_none_scalar_t
Enables a template if all given types are non-scalar types that are a valid kernel generator expressi...
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...