1 #ifndef STAN_MATH_FWD_MAT_FUN_DIVIDE_HPP 2 #define STAN_MATH_FWD_MAT_FUN_DIVIDE_HPP 10 template <
typename T,
int R,
int C>
11 inline Eigen::Matrix<fvar<T>, R, C>
divide(
13 Eigen::Matrix<fvar<T>, R, C> res(v.rows(), v.cols());
14 for (
int i = 0; i < v.rows(); i++) {
15 for (
int j = 0; j < v.cols(); j++)
16 res(i, j) = v(i, j) / c;
21 template <
typename T,
int R,
int C>
22 inline Eigen::Matrix<fvar<T>, R, C>
divide(
23 const Eigen::Matrix<
fvar<T>, R, C>& v,
double c) {
24 Eigen::Matrix<fvar<T>, R, C> res(v.rows(), v.cols());
25 for (
int i = 0; i < v.rows(); i++) {
26 for (
int j = 0; j < v.cols(); j++)
27 res(i, j) = v(i, j) / c;
32 template <
typename T,
int R,
int C>
33 inline Eigen::Matrix<fvar<T>, R, C>
divide(
const Eigen::Matrix<double, R, C>& v,
35 Eigen::Matrix<fvar<T>, R, C> res(v.rows(), v.cols());
36 for (
int i = 0; i < v.rows(); i++) {
37 for (
int j = 0; j < v.cols(); j++)
38 res(i, j) = v(i, j) / c;
43 template <
typename T,
int R,
int C>
49 template <
typename T,
int R,
int C>
51 const Eigen::Matrix<
fvar<T>, R, C>& v,
double c) {
55 template <
typename T,
int R,
int C>
57 const Eigen::Matrix<double, R, C>& v,
const fvar<T>& c) {
fvar< T > operator/(const fvar< T > &x1, const fvar< T > &x2)
Return the result of dividing the first argument by the second.
Eigen::Matrix< fvar< T >, R, C > divide(const Eigen::Matrix< fvar< T >, R, C > &v, const fvar< T > &c)
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.