All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
quad_form_sym.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP
#define STAN_MATH_REV_MAT_FUN_QUAD_FORM_SYM_HPP
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
#include <stan/math/rev/core.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/fun/typedefs.hpp>
#include <stan/math/rev/mat/fun/typedefs.hpp>
#include <stan/math/prim/mat/fun/value_of.hpp>
#include <stan/math/prim/mat/fun/quad_form.hpp>
#include <stan/math/prim/mat/err/check_multiplicable.hpp>
#include <stan/math/prim/mat/err/check_square.hpp>
#include <stan/math/prim/mat/err/check_symmetric.hpp>
#include <stan/math/rev/mat/fun/quad_form.hpp>
namespace stan {
namespace math {
template <typename TA, int RA, int CA, typename TB, int RB, int CB>
inline typename
boost::enable_if_c< boost::is_same<TA, var>::value ||
boost::is_same<TB, var>::value,
Eigen::Matrix<var, CB, CB> >::type
quad_form_sym(const Eigen::Matrix<TA, RA, CA>& A,
const Eigen::Matrix<TB, RB, CB>& B) {
stan::math::check_square("quad_form", "A", A);
stan::math::check_symmetric("quad_form_sym", "A", A);
stan::math::check_multiplicable("quad_form_sym",
"A", A,
"B", B);
quad_form_vari<TA, RA, CA, TB, RB, CB> *baseVari
= new quad_form_vari<TA, RA, CA, TB, RB, CB>(A, B, true);
return baseVari->_impl->C_;
}
template <typename TA, int RA, int CA, typename TB, int RB>
inline typename
boost::enable_if_c< boost::is_same<TA, var>::value ||
boost::is_same<TB, var>::value,
var >::type
quad_form_sym(const Eigen::Matrix<TA, RA, CA>& A,
const Eigen::Matrix<TB, RB, 1>& B) {
stan::math::check_square("quad_form", "A", A);
stan::math::check_symmetric("quad_form_sym", "A", A);
stan::math::check_multiplicable("quad_form_sym",
"A", A,
"B", B);
quad_form_vari<TA, RA, CA, TB, RB, 1> *baseVari
= new quad_form_vari<TA, RA, CA, TB, RB, 1>(A, B, true);
return baseVari->_impl->C_(0, 0);
}
}
}
#endif
core.hpp
check_multiplicable.hpp
stan::math::check_symmetric
bool check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is symmetric.
Definition: check_symmetric.hpp:38
check_symmetric.hpp
typedefs.hpp
stan::math::check_multiplicable
bool check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Return true if the matrices can be multiplied.
Definition: check_multiplicable.hpp:33
Eigen.hpp
value_of.hpp
stan::math::quad_form_sym
Eigen::Matrix< fvar< T >, CB, CB > quad_form_sym(const Eigen::Matrix< fvar< T >, RA, CA > &A, const Eigen::Matrix< double, RB, CB > &B)
Definition: quad_form_sym.hpp:14
quad_form.hpp
quad_form.hpp
stan::math::check_square
bool check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is square.
Definition: check_square.hpp:28
typedefs.hpp
check_square.hpp

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