1 #ifndef STAN_MATH_FWD_MAT_FUN_SQUARED_DISTANCE_HPP 2 #define STAN_MATH_FWD_MAT_FUN_SQUARED_DISTANCE_HPP 26 template <
typename T,
int R,
int C>
28 const Eigen::Matrix<double, R, C>& v2) {
32 Eigen::Matrix<fvar<T>, R, C> v3 =
subtract(v1, v2);
51 template <
typename T,
int R1,
int C1,
int R2,
int C2>
53 const Eigen::Matrix<double, R2, C2>& v2) {
57 Eigen::Matrix<double, R1, C1> t_v2 = v2.transpose();
58 Eigen::Matrix<fvar<T>, R1, C1> v3 =
subtract(v1, t_v2);
75 template <
typename T,
int R,
int C>
77 const Eigen::Matrix<
fvar<T>, R, C>& v2) {
81 Eigen::Matrix<fvar<T>, R, C> v3 =
subtract(v1, v2);
100 template <
typename T,
int R1,
int C1,
int R2,
int C2>
102 const Eigen::Matrix<
fvar<T>, R2, C2>& v2) {
106 Eigen::Matrix<double, R2, C2> t_v1 = v1.transpose();
107 Eigen::Matrix<fvar<T>, R2, C2> v3 =
subtract(t_v1, v2);
123 template <
typename T,
int R,
int C>
125 const Eigen::Matrix<
fvar<T>, R, C>& v2) {
129 Eigen::Matrix<fvar<T>, R, C> v3 =
subtract(v1, v2);
148 template <
typename T,
int R1,
int C1,
int R2,
int C2>
150 const Eigen::Matrix<
fvar<T>, R2, C2>& v2) {
154 Eigen::Matrix<fvar<T>, R2, C2> t_v1 = v1.transpose();
155 Eigen::Matrix<fvar<T>, R2, C2> v3 =
subtract(t_v1, v2);
auto subtract(const matrix_cl &A, const matrix_cl &B)
Matrix subtraction on the OpenCL device Subtracts the second matrix from the first matrix and stores ...
void check_vector(const char *function, const char *name, const Eigen::Matrix< T, R, C > &x)
Check if the matrix is either a row vector or column vector.
fvar< T > dot_self(const Eigen::Matrix< fvar< T >, R, C > &v)
fvar< T > squared_distance(const Eigen::Matrix< fvar< T >, R, C > &v1, const Eigen::Matrix< double, R, C > &v2)
Returns the squared distance between the specified vectors of the same dimensions.
void check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Check if two structures at the same size.
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.