You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stan/math/rev/fun/csr_matrix_times_vector.hpp
+57-5Lines changed: 57 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,23 @@ namespace stan {
12
12
namespacemath {
13
13
14
14
namespaceinternal {
15
+
/**
16
+
* `vari` for csr_matrix_times_vector
17
+
* @note `csr_matrix_times_vector` uses the old inheritance
18
+
* style to set up the reverse pass because of a linking
19
+
* issue on windows when using flto.
20
+
*
21
+
* @tparam Result_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or a `var<T>` where `T` inherits from `Eigen::DenseBase`
22
+
* @tparam WMat_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or `double`. Or a `var<T>` where `T` inherits from `Eigen::SparseBase`
23
+
* @tparam B_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or `double`. Or a `var<T>` where `T` inherits from `Eigen::DenseBase`
voidchain_internal(Result&& res, WMat&& w_mat, B&& b) {
86
+
inlinevoidchain_internal(Result&& res, WMat&& w_mat, B&& b) {
47
87
b.adj() += w_mat.transpose() * res.adj();
48
88
}
49
89
};
90
+
91
+
/**
92
+
* Helper function to construct the csr_adjoint struct.
93
+
* @tparam Result_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or a `var<T>` where `T` inherits from `Eigen::DenseBase`
94
+
* @tparam WMat_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or `double`. Or a `var<T>` where `T` inherits from `Eigen::SparseBase`
95
+
* @tparam B_ Either a type inheriting from `Eigen::DenseBase` with scalar type `var` or `double`. Or a `var<T>` where `T` inherits from `Eigen::DenseBase`
96
+
*
97
+
* @param res The vector result of the forward pass calculation
0 commit comments