1 #ifndef STAN_MATH_REV_MAT_FUN_EIGEN_NUMTRAITS_HPP
2 #define STAN_MATH_REV_MAT_FUN_EIGEN_NUMTRAITS_HPP
15 struct NumTraits<stan::math::var> {
44 return std::numeric_limits<double>::epsilon();
82 RequireInitialization = 0,
95 struct significant_decimals_default_impl<stan::math::var, false> {
96 static inline int run() {
99 return cast<double, int>(
ceil(-
log(std::numeric_limits<double>
110 struct scalar_product_traits<stan::math::var, double> {
119 struct scalar_product_traits<double, stan::math::var> {
126 template<
typename Index,
bool ConjugateLhs,
bool ConjugateRhs>
127 struct general_matrix_vector_product<Index, stan::math::var, ColMajor,
132 typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType
134 enum { LhsStorageOrder = ColMajor };
136 EIGEN_DONT_INLINE
static void run(
142 for (Index i = 0; i <
rows; i++) {
147 (static_cast<int>(LhsStorageOrder) == static_cast<int>(ColMajor))
148 ?(&lhs[i]):(&lhs[i*lhsStride]),
149 (static_cast<int>(LhsStorageOrder) == static_cast<int>(ColMajor))
151 rhs, rhsIncr, cols));
155 template<
typename Index,
bool ConjugateLhs,
bool ConjugateRhs>
156 struct general_matrix_vector_product<Index, stan::math::var,
157 RowMajor, ConjugateLhs,
161 typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType
163 enum { LhsStorageOrder = RowMajor };
165 EIGEN_DONT_INLINE
static void
170 for (Index i = 0; i <
rows; i++) {
175 (static_cast<int>(LhsStorageOrder) == static_cast<int>(ColMajor))
176 ? (&lhs[i]) : (&lhs[i*lhsStride]),
177 (static_cast<int>(LhsStorageOrder) == static_cast<int>(ColMajor))
179 rhs, rhsIncr, cols));
183 template<
typename Index,
int LhsStorageOrder,
bool ConjugateLhs,
184 int RhsStorageOrder,
bool ConjugateRhs>
185 struct general_matrix_matrix_product<Index, stan::math::var,
186 LhsStorageOrder, ConjugateLhs,
188 ConjugateRhs, ColMajor> {
191 typedef typename scalar_product_traits<LhsScalar, RhsScalar>::ReturnType
198 level3_blocking<LhsScalar, RhsScalar>& ,
199 GemmParallelInfo<Index>* ) {
200 for (Index i = 0; i <
cols; i++) {
201 general_matrix_vector_product<Index,
LhsScalar, LhsStorageOrder,
203 ::run(rows, depth, _lhs, lhsStride,
204 &_rhs[(static_cast<int>(RhsStorageOrder)
205 == static_cast<int>(ColMajor))
206 ? (i*rhsStride) :(i) ],
207 (static_cast<int>(RhsStorageOrder)
208 == static_cast<int>(ColMajor)) ? (1) : (rhsStride),
209 &res[i*resStride], 1, alpha);
static Real lowest()
Return standard library's lowest for double-precision floating point, -std::numeric_limits<double...
int rows(const Eigen::Matrix< T, R, C > &m)
Return the number of rows in the specified matrix, vector, or row vector.
stan::math::var RhsScalar
scalar_product_traits< LhsScalar, RhsScalar >::ReturnType ResScalar
static EIGEN_DONT_INLINE void run(Index rows, Index cols, const LhsScalar *lhs, Index lhsStride, const RhsScalar *rhs, Index rhsIncr, ResScalar *res, Index resIncr, const ResScalar &alpha)
fvar< T > log(const fvar< T > &x)
stan::math::var LhsScalar
static Real dummy_precision()
Return dummy precision.
stan::math::var NonInteger
Non-integer valued variables.
Independent (input) and dependent (output) variables for gradients.
static Real highest()
Return standard library's highest for double-precision floating point, std::numeric_limits<double>max...
stan::math::var RhsScalar
stan::math::var ReturnType
stan::math::var LhsScalar
stan::math::var Real
Real-valued variables.
static Real epsilon()
Return standard library's epsilon for double-precision floating point, std::numeric_limits<double>::e...
stan::math::var LhsScalar
int cols(const Eigen::Matrix< T, R, C > &m)
Return the number of columns in the specified matrix, vector, or row vector.
scalar_product_traits< LhsScalar, RhsScalar >::ReturnType ResScalar
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
double e()
Return the base of the natural logarithm.
stan::math::var RhsScalar
stan::math::var Nested
Nested variables.
static void run(Index rows, Index cols, Index depth, const LhsScalar *_lhs, Index lhsStride, const RhsScalar *_rhs, Index rhsStride, ResScalar *res, Index resStride, const ResScalar &alpha, level3_blocking< LhsScalar, RhsScalar > &, GemmParallelInfo< Index > *)
scalar_product_traits< LhsScalar, RhsScalar >::ReturnType ResScalar
fvar< T > ceil(const fvar< T > &x)
static EIGEN_DONT_INLINE void run(Index rows, Index cols, const LhsScalar *lhs, Index lhsStride, const RhsScalar *rhs, Index rhsIncr, ResScalar *res, Index resIncr, const RhsScalar &alpha)
stan::math::var ReturnType