Stan Math Library: stan::math::apply_scalar_unary< F, T > Struct Template Reference

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Static Public Member Functions | List of all members
stan::math::apply_scalar_unary< F, T > Struct Template Reference

Base template class for vectorization of unary scalar functions defined by a template class `F` to a scalar, standard library vector, or Eigen dense matrix expression template. More...

`#include <apply_scalar_unary.hpp>`

## Public Types
typedef Eigen::internal::traits< T >::Scalar | scalar_t
| Type of underlying scalar for the matrix type T. More...
typedef Eigen::Matrix< scalar_t, T::RowsAtCompileTime, T::ColsAtCompileTime > | return_t
| Return type for applying the function elementwise to a matrix expression template of type T. More...

## Static Public Member Functions
static return_t | apply (const T &x)
| Return the result of applying the function defined by the template parameter F to the specified matrix argument. More...

## Detailed Description

### template<typename F, typename T>
struct stan::math::apply_scalar_unary< F, T >

Base template class for vectorization of unary scalar functions defined by a template class `F` to a scalar, standard library vector, or Eigen dense matrix expression template.

The base class applies to any Eigen dense matrix expression template. Specializations define applications to scalars (primitive or autodiff in the corresponding autodiff library directories) or to standard library vectors of vectorizable types (primitives, Eigen dense matrix expressions, or further standard vectors).

Each specialization must define the typedef `return_t` for the vectorized return type and the function `apply` which defines the vectorization or base application of the function defined statically by the class F. The function definition class F defines a static function `fun()`, which defines the function's behavior on scalars.

Template Parameters

  F | Type of function to apply.
  T | Type of argument to which function is applied.

Definition at line 36 of file apply_scalar_unary.hpp.

## Member Typedef Documentation

template<typename F , typename T >

typedef Eigen::Matrix<scalar_t, T::RowsAtCompileTime, T::ColsAtCompileTime> stan::math::apply_scalar_unary< F, T >::return_t

Return type for applying the function elementwise to a matrix expression template of type T.

Definition at line 48 of file apply_scalar_unary.hpp.

template<typename F , typename T >

typedef Eigen::internal::traits<T>::Scalar stan::math::apply_scalar_unary< F, T >::scalar_t

Type of underlying scalar for the matrix type T.

Definition at line 40 of file apply_scalar_unary.hpp.

## Member Function Documentation

template<typename F , typename T >

static return_t stan::math::apply_scalar_unary< F, T >::apply | ( | const T & | x | ) |
| inlinestatic

Return the result of applying the function defined by the template parameter F to the specified matrix argument.

Parameters

  x | Matrix to which operation is applied.

Returns
  Componentwise application of the function specified by F to the specified matrix.

Definition at line 58 of file apply_scalar_unary.hpp.

The documentation for this struct was generated from the following file:

- stan/math/prim/mat/vectorize/apply_scalar_unary.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.