1#ifndef STAN_MATH_REV_CORE_ARENA_MATRIX_HPP
2#define STAN_MATH_REV_CORE_ARENA_MATRIX_HPP
19template <
typename MatrixType>
22 using Scalar =
typename std::decay_t<MatrixType>::Scalar;
23 using Base = Eigen::Map<MatrixType>;
52 :
Base::Map(allocator.template allocate<
Scalar>(rows * cols), rows, cols),
65 :
Base::Map(allocator.template allocate<
Scalar>(size), size),
73 template <
typename T,
typename Expr>
77 allocator.template allocate<
Scalar>(other.size()),
88 (*this).noalias() = other;
104 :
Base::Map(const_cast<
Scalar*>(other.data()), other.rows(),
112 using Base::operator=;
122 Base(
const_cast<Scalar*
>(other.data()), other.rows(), other.cols());
134 template <
typename T>
140 new (
this)
Base(
allocator_.template allocate<Scalar>(a.size()), a.cols(),
144 new (
this)
Base(
allocator_.template allocate<Scalar>(a.size()), a.rows(),
154template <
typename T,
typename Expr>
156 const Expr& expr)
noexcept {
160template <
typename T,
typename Expr>
162 const Expr& expr)
noexcept {
166template <
typename Expr>
174 std::cout << name <<
"(" << x.rows() <<
", " << x.cols() <<
")" << std::endl;
175 std::cout << x << std::endl;
185struct traits<
riccati::arena_matrix<T>> : traits<Eigen::Map<T>> {
186 using base = traits<Eigen::Map<T>>;
187 using XprKind =
typename Eigen::internal::traits<std::decay_t<T>>::XprKind;
188 using Scalar =
typename std::decay_t<T>::Scalar;
190 PlainObjectTypeInnerSize = base::PlainObjectTypeInnerSize,
191 InnerStrideAtCompileTime = base::InnerStrideAtCompileTime,
192 OuterStrideAtCompileTime = base::OuterStrideAtCompileTime,
193 Alignment = base::Alignment,
static constexpr int ColsAtCompileTime
static constexpr int RowsAtCompileTime
typename std::decay_t< MatrixType >::Scalar Scalar
arena_matrix & operator=(const arena_matrix< MatrixType > &other)
arena_matrix(const Base &other)
Eigen::Map< MatrixType > Base
arena_matrix & operator=(const T &a)
std::decay_t< MatrixType > PlainObject
arena_matrix(arena_allocator< T, arena_alloc > &allocator, Eigen::Index rows, Eigen::Index cols)
arena_matrix(arena_allocator< T, arena_alloc > &allocator, const Expr &other)
arena_matrix(const arena_matrix< MatrixType > &other)
arena_matrix(arena_allocator< T, arena_alloc > &allocator)
arena_matrix(arena_allocator< T, arena_alloc > &allocator, Eigen::Index size)
Eigen::internal::remove_all< Base >::type NestedExpression
#define RICCATI_ALWAYS_INLINE
auto eval(arena_allocator< T, arena_alloc > &arena, const Expr &expr) noexcept
auto to_arena(arena_allocator< T, arena_alloc > &arena, const Expr &expr) noexcept
void print(const char *name, const arena_matrix< T > &x)
traits< Eigen::Map< T > > base
typename std::decay_t< T >::Scalar Scalar
typename Eigen::internal::traits< std::decay_t< T > >::XprKind XprKind