@@ -32,6 +32,14 @@ struct BlockDiagonalLDLT {
32
32
Eigen::Matrix<_Scalar, _Rows, _Cols>
33
33
sqrt_solve (const Eigen::Matrix<_Scalar, _Rows, _Cols> &rhs) const ;
34
34
35
+ template <class _Scalar , int _Options, typename _StorageIndex>
36
+ Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic>
37
+ solve (const Eigen::SparseMatrix<_Scalar, _Options, _StorageIndex> &rhs) const ;
38
+
39
+ template <class _Scalar , int _Options, typename _StorageIndex>
40
+ Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic> sqrt_solve (
41
+ const Eigen::SparseMatrix<_Scalar, _Options, _StorageIndex> &rhs) const ;
42
+
35
43
template <class _Scalar , int _Rows, int _Cols>
36
44
Eigen::Matrix<_Scalar, _Rows, _Cols>
37
45
solve (const Eigen::Matrix<_Scalar, _Rows, _Cols> &rhs,
@@ -102,6 +110,38 @@ inline Eigen::Matrix<_Scalar, _Rows, _Cols> BlockDiagonalLDLT::sqrt_solve(
102
110
return output;
103
111
}
104
112
113
+ template <class _Scalar , int _Options, typename _StorageIndex>
114
+ inline Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic>
115
+ BlockDiagonalLDLT::solve (
116
+ const Eigen::SparseMatrix<_Scalar, _Options, _StorageIndex> &rhs) const {
117
+ ALBATROSS_ASSERT (cols () == rhs.rows ());
118
+ Eigen::Index i = 0 ;
119
+ Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic> output (rows (),
120
+ rhs.cols ());
121
+ for (const auto &b : blocks) {
122
+ const auto rhs_chunk = rhs.block (i, 0 , b.rows (), rhs.cols ());
123
+ output.block (i, 0 , b.rows (), rhs.cols ()) = b.solve (rhs_chunk);
124
+ i += b.rows ();
125
+ }
126
+ return output;
127
+ }
128
+
129
+ template <class _Scalar , int _Options, typename _StorageIndex>
130
+ inline Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic>
131
+ BlockDiagonalLDLT::sqrt_solve (
132
+ const Eigen::SparseMatrix<_Scalar, _Options, _StorageIndex> &rhs) const {
133
+ ALBATROSS_ASSERT (cols () == rhs.rows ());
134
+ Eigen::Index i = 0 ;
135
+ Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic> output (rows (),
136
+ rhs.cols ());
137
+ for (const auto &b : blocks) {
138
+ const auto rhs_chunk = rhs.block (i, 0 , b.rows (), rhs.cols ());
139
+ output.block (i, 0 , b.rows (), rhs.cols ()) = b.sqrt_solve (rhs_chunk);
140
+ i += b.rows ();
141
+ }
142
+ return output;
143
+ }
144
+
105
145
inline std::map<size_t , Eigen::Index>
106
146
BlockDiagonalLDLT::block_to_row_map () const {
107
147
Eigen::Index row = 0 ;
0 commit comments