| 2071 | |
| 2072 | template <class TM, class TV_ROW, class TV_COL> |
| 2073 | void SparseCholesky<TM, TV_ROW, TV_COL> :: |
| 2074 | Smooth (BaseVector & u, const BaseVector & f, BaseVector & y) const |
| 2075 | { |
| 2076 | static Timer t("SparseCholesky::Smooth"); |
| 2077 | RegionTimer reg(t); |
| 2078 | |
| 2079 | if(dynamic_pointer_cast<const SparseMatrixSymmetric<TM,TV>>(this->matrix.lock())) |
| 2080 | { |
| 2081 | // use the original one ... |
| 2082 | SparseFactorization::Smooth(u,f,y); |
| 2083 | return; |
| 2084 | } |
| 2085 | |
| 2086 | const FlatVector<TVX> fu = u.FV<TVX> (); |
| 2087 | FlatVector<TVX> fy = y.FV<TVX> (); |
| 2088 | |
| 2089 | Vector<TVX> hy(this->nused); |
| 2090 | auto spmat = dynamic_pointer_cast<const SparseMatrix<TM,TV,TV>> (this->matrix.lock()); |
| 2091 | if(!spmat) |
| 2092 | throw Exception("A matrix not available any more, needed for Smooth!"); |
| 2093 | auto & hmat = *spmat; |
| 2094 | |
| 2095 | ParallelFor (this->nused, [&] (int i) |
| 2096 | { |
| 2097 | hy(i) = fy(inv_order[i]) - hmat.RowTimesVector(inv_order[i], fu); |
| 2098 | }); |
| 2099 | |
| 2100 | SolveReordered(hy); |
| 2101 | |
| 2102 | ParallelFor (this->nused, [&] (int i) |
| 2103 | { |
| 2104 | fu(inv_order[i]) += hy(i); |
| 2105 | }); |
| 2106 | } |
| 2107 | |
| 2108 | |
| 2109 |
nothing calls this directly
no test coverage detected